For Newbies The "Basic Database Primer V2)

Jan Schenkel janschenkel at yahoo.com
Fri Jan 14 02:06:38 EST 2005


--- Bob Hartley <rev at armbase.com> wrote:
> Hi All.
> Version 2 of the basic database primer series is now
> on revonline. It is in 
> general categories.
> 

Nice work -- it will help anyone who wanted to do
database-related things but was afraid to start...

> Now I know it is for newbies, however, could some of
> the rev gurus please 
> have a look at the "search->List" popup and the way
> is modifies the list. 
> Once the list is filtered with this popup it wont
> allow double clicking of 
> the listfield entry to go to the corresponding card.
> 

My first thought : save the card ID in the field, but
out of view -- let me explain.

- Set the vGrid of the index field to true.
- Set the tabStops of the index field to the width of
the index field.

=> now anything after a 'tab' char won't show in your
index field, so there we can store our data !

- Change the index field script so that the
mouseDoubleUp handler is something like :
##
on mouseDoubleUp
  put the hilitedLine of me into tLine
  set the itemDelimiter to tab
  put item 2 of line tLine of me into tCardID
  go card ID tCardID of stack "Foobar"
end mouseDoubleUp
##

- Change the index building script to something like :
##
  put the number of cards of stack "Foobar" \
      into tNumber
  go first card of stack "Foobar"
  repeat with i = 1 to tNumber
    put field "Title" & tab & the ID of this card & \
        return after tIndexText
    go next
  end repeat
  ## we have the data, so go back to our index stack
  go card "Index" of stack "Index"
  put char 1 to -2 of tIndexText into field "Index"
##

=> So we rebuild the index, keeping track of the card
ID where the actual data can be found ; when the user
double-clicks a line in the index field, the field can
quickly extract the ID-number and the user never needs
to know as it's invisible.

- Now when you filter the data, use something like :
##
  put "*" & field "filter" & "*" & tab & "*" \
      into tCombinedFilter
  filter field "Index" with tCombinedFilter
##

=> when the lines are filtered, it saves those lines
that contain the data before the tab ; pretty nifty,
isn't it ?

> If I get this sorted I can get on with the rest of
> the demo app.
> 
> Cheers
> Bob
> 

Hope to have nudged you in the right direction,

Jan Schenkel
----
Quartam - Tools for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250


More information about the use-livecode mailing list