Database - functionality for front end application

Jan Schenkel janschenkel at yahoo.com
Tue Nov 18 00:58:05 EST 2003


--- Melvin Cox <melcox at hotmail.com> wrote:
> Jan:
> 
> MANY THANKS for your prompt and very thorough
> response.
> 
> I have successfully implemented each of your
> examples.  The only 
> modification I needed to make was to add quotes
> around the value of the 
> "affiliation" field in Problem #1 (my database
> requires the use of quotes as 
> string delimiters).
> 
> My code for the group is therefore:
> 
>
-----------------------------------------------------------------------------------
> 
> on mouseUp
>    put "SELECT * FROM Business WHERE Bid=" \
>        into tSQLQuery
>    put quote & field "affiliation" & quote after
> tSQLQuery
>    revSetSQLOfQuery "AffiliatedBusiness", tSQLQuery
> end mouseUp
> 
>
-----------------------------------------------------------------------------------
> 
> After implementing your code for Problems One and
> Two, I noticed that the 
> desired functionalities worked flawlessly EXCEPT
> when making updates to the 
> affiliation field on the form.
> 
> I have worked around this by adding an on closeField
> statement on the 
> affiliation field which combines the code addressing
> Problems One and Two.
> 
> Am I correct in the assumption that the code for a
> field has prescedence 
> over the code for the form?
> 
>
-----------------------------------------------------------------------------------
> 
> on CloseField
>   put "SELECT * FROM Business WHERE Bid=" \
>       into tSQLQuery
>   put quote & field "affiliation" & quote after
> tSQLQuery
>   revSetSQLOfQuery "AffiliatedBusiness", tSQLQuery
> 
>   put the date && the long time into tDate
>   convert tDate to dateItems
>   put item 1 of tDate & "-" & \
>       item 2 of tDate & "-" & \
>       item 3 of tDate & " " & \
>       item 4 of tDate & ":" & \
>       item 5 of tDate & ":" & \
>       item 6 of tDate into field "last_update"
> end CloseField
> 
>
-----------------------------------------------------------------------------------
> 
> My sole remaining problem (for the moment) is how to
> force capitalization of 
> the affiliation field, while at the same time
> retaining the other 
> functionalities, as above.
> 
> Adding your on keyDown statement to the script for
> the affiliation field 
> results in data entry being CAPITALIZED, but the
> update of the timestamp and 
> display in the CompanyName field are not done.
> 
> What am I doing wrong?
> 
> 
> M.C.
> 

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)

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


More information about the use-livecode mailing list