getting info from a Data Grid - which out of three methods is best?

Trevor DeVore lists at
Thu Apr 8 09:31:40 EDT 2010

On Apr 7, 2010, at 5:03 PM, Josh Mellicker wrote:

> Would you:
> 1. scan the grid line by line, trying for a value match with data  
> grid commands?
> 2. get the dgData and loop through the array?
> 3. get the dgText and loop through the tab delimited data?
> (NOTE: We can't really depend on the "filter" command, since it's  
> conceivable columns could change order or position in the future.)

Grab the dgData and loop through it.

put the dgData of group "MyGrid" into theDataA

repeat for each key theIndex in theDataA
  ... perform find on theDataA[theIndex]["firstName"], etc.
end repeat

Note that the above will not loop through the records in the order  
they appear but that may or may not matter to you. In the end you have  
the index (theIndex variable) that you can use in the Data Grid API.

If you want to loop through the records in order then follow the  
example in the lesson on exporting data.

How Do I Export Data From A Data Grid?: < 

Trevor DeVore
Blue Mango Learning Systems
Releasable Revolution Resources for Developers:

More information about the Use-livecode mailing list