Search in arrays

Bob Sneidar bobsneidar at iotecdigital.com
Thu Dec 10 12:15:55 EST 2015


Sounds like data returned from a database query. SQL Yoga returns query data in this format. What I do is I populate a datagrid with the returned array data, then I use a selectionChanged handler in the data grid script to populate whatever I want. In my case I have distinct fields named "fld" & the column name. (I also have buttons and menus similarly named but that's not important now. I then have a populate handler as a back script that I pass the record array to which populates any fields, menus or buttons with the data. 

The net result is a system I can use with any data grid data simply by calling the populate command. Further, I also have an Extract command that will take the value in any fields, buttons or menus and populate an array with related names. Now I have a way to read data from a database, present it to the user, gather the results, check for errors which I haven't described here, then update or insert to the database as necessary. 

If you need to find data, use the dgFindIndex or dgFindLine commands. I have another self contained search object which does hot searches of a data grid so that as you type, the data in the datagrid will be filtered. I copy/paste the object, set a few variables in the object's script to tell it the name of the data grid and the columns I want to include in the hot search and a couple other things, and presto! It just works! 

Bob S


> On Dec 9, 2015, at 05:11 , tkuypers at telenet.be wrote:
> 
> Hi Mark,
> 
> Either I don’t understand this, or I didn’t explain it correctly…
> gArray contains app. 10.000 lines of data
> Item 1 is a unique ID
> Item 2 contains the supplier
> Item 3 contains the main group
> Item 4 contains subgroup 1
> Item 5 contains subgroup 2
> Item 6 contains subgroup 3
> Item 7 contains subgroup 4
> Item 8 contains subgroup 5
> Item 9-15 contains productinfo
> 
> I filled a list field with the keys of item 3
> When I click on an item in that list, I would like to see a second list filled with the keys belonging to the clicked item.
> 
> So when I understand your code, this should be:
> on mouseUp
> 	put gArray[the selectedText of field “Maingroup"] into field “Subgroup"
> end mouseUp
> But this doesn’t do anything…
> 
> What am I missing?
> 
> 
> Met vriendelijke groeten,
> Warm Regards,



More information about the use-livecode mailing list