Database - functionality for front end application
Melvin Cox
melcox at hotmail.com
Fri Nov 21 02:54:13 EST 2003
Jan:
I have successfully implemented each of your suggestions.
The only change I have made is in the script of the field "Affilitation"
(all caps, length limited to 10 characters).
The closeField handler will not work when the script includes the keyDown
and Capitalize handlers. The Capitalize handler changes the field's
contents using a put statement.
I have therefore substituted an exitField handler and used an if statement
and a local variable to compare the field's current value to the value of
the field at the time an openField handler was triggered.
My script liike like:
--------------------------------------------------------------------
--declare a local variable 'saved'
local saved
--place the current value of the affiliation field into the 'saved' variable
on openField
put field "affiliation" into saved
end openField
--when leaving the affiliation field, compare current value to the 'saved'
value
--if value has changed, trigger updates to the Company Name and Last Update
fields
on exitField
if field "affiliation" <> saved
then
UpdateCompanyName
closeField
else
pass exitField
end if
end exitField
--limit field to 10 characters and insure capitalization
on keyDown pWhichKey
if the length of me >= 10 then beep
else
send "Capitalize" to me in 5 milliseconds
pass keyDown
end if
end keyDown
on Capitalize
put the selectedChunk of me into tChunk
put upper(me) into me
select tChunk
end Capitalize
--------------------------------------------------------------------
Many thanks for pointing the way forward!
Cheers,
Melvin Cox
----Original Message Follows----
From: Jan Schenkel <janschenkel at yahoo.com>
Reply-To: How to use Revolution <use-revolution at lists.runrev.com>
To: How to use Revolution <use-revolution at lists.runrev.com>
Subject: Re: Database - functionality for front end application
Date: Mon, 17 Nov 2003 21:58:05 -0800 (PST)
MIME-Version: 1.0
Received: from mc3-f3.hotmail.com ([64.4.50.139]) by mc3-s20.hotmail.com
with Microsoft SMTPSVC(5.0.2195.6713); Mon, 17 Nov 2003 21:59:19 -0800
Received: from mail.runrev.com ([207.36.15.228]) by mc3-f3.hotmail.com with
Microsoft SMTPSVC(5.0.2195.6713); Mon, 17 Nov 2003 21:58:20 -0800
Received: from www.runrev.com (localhost [127.0.0.1])by mail.runrev.com
(Postfix) with ESMTPid 3678F930084; Tue, 18 Nov 2003 00:56:42 -0500 (EST)
Received: from web60503.mail.yahoo.com
(web60503.mail.yahoo.com[216.109.116.124])by mail.runrev.com (Postfix) with
SMTP id 018FE93005Ffor <use-revolution at lists.runrev.com>;Tue, 18 Nov 2003
00:56:40 -0500 (EST)
Received: from [213.224.83.167] by web60503.mail.yahoo.com via HTTP;Mon, 17
Nov 2003 21:58:05 PST
X-Message-Info: KtxBqYfPyq2nieRMDaD/YSso4X0bxA4j
Delivered-To: use-revolution at lists.runrev.com
Message-ID: <20031118055805.52586.qmail at web60503.mail.yahoo.com>
In-Reply-To: <Law10-F169oOesurQZ8000100a5 at hotmail.com>
X-BeenThere: use-revolution at lists.runrev.com
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: How to use Revolution <use-revolution.lists.runrev.com>
List-Unsubscribe:
<http://lists.runrev.com/mailman/listinfo/use-revolution>,<mailto:use-revolution-request at lists.runrev.com?subject=unsubscribe>
List-Archive: <http://lists.runrev.com/pipermail/use-revolution>
List-Post: <mailto:use-revolution at lists.runrev.com>
List-Help: <mailto:use-revolution-request at lists.runrev.com?subject=help>
List-Subscribe:
<http://lists.runrev.com/mailman/listinfo/use-revolution>,<mailto:use-revolution-request at lists.runrev.com?subject=subscribe>
Sender: use-revolution-bounces at lists.runrev.com
Errors-To: use-revolution-bounces at lists.runrev.com
Return-Path: use-revolution-bounces at lists.runrev.com
X-OriginalArrivalTime: 18 Nov 2003 05:58:20.0703 (UTC)
FILETIME=[F82FEAF0:01C3AD98]
Hi Melvin,
Good to see you got a lot further already ; now let's
refine the earlier solution a bit.
Add the following handler to the card script :
--
on UpdateCompanyName
put "SELECT * FROM Business WHERE Bid=" \
into tSQLQuery
put "'" & field "affiliation" & "' ;" after \
tSQLQuery
revSetSQLOfQuery "AffiliatedBusiness", tSQLQuery
end UpdateCompanyName
--
[Note that I've replaced the quotes surrounding the
field content with single quotes and ended with a
space and a semicolon, so that the query will also
work on FileMaker and other 'picky' databases.]
To somewhat clean up your scripts, you can now change
the script of the navigation group to :
--
on mouseUp
UpdateCompanyName
end mouseUp
--
Now change the closeField handler in the script of the
field "Affilitation" to :
--
on closeField
UpdateCompanyName
pass closeField
end closeField
--
The 'pass' command will allow the closeField message
to traverse the controls down the message path, so in
our case, the closeField in the card script will also
be invoked, and thus update the timestamp.
Hope this helped,
Jan Schenkel.
=====
"As we grow older, we grow both wiser and more foolish at the same time."
(La Rochefoucauld)
_________________________________________________________________
Is there a gadget-lover on your gift list? MSN Shopping has lined up some
good bets! http://shopping.msn.com
More information about the use-livecode
mailing list