Data Crid - set the dgNumberOfRecords

Bob Sneidar bobsneidar at
Mon Apr 20 22:57:50 CEST 2015

The best way to do this is to build an array from the cursor. What I have never understood is why LC does not have a cursor to array function. It’s easy enough to write one in LC, but having the engine do it would be orders of magnitude faster for large cursors. 

What I do is I use sqlYoga from Blue Mango Group. It can return you data as arrays that work perfectly with Data Grids. Given your table column names are the same as your data grid column names, query your database, set the dgData of your data grid to the resulting array, and there you have it. Presto bingo. 

An advantage to this approach is that even if you have not defined columns in your Data Grid that correspond to keys in your array, the data is still stored in the Data Grid. The columns will simply be invisible. This means for example, your data grid can display a first name and last name, while the Data Grid array can contain the unique key from the database and other information you may want for other purposes. Then when writing data back to the database table, you have intact each unique ID to reference the original record. 

Bob S

> On Apr 1, 2015, at 20:16 , JB <sundown at> wrote:
> I am using a table form of data grid and trying
> to display the records using a cursor and then
> setting the dgNumberOfRecords.
> I am able to get the cursor and the record count
> of the cursor and I can get dgNumberOfRecords
> before I set dgNumberOfRecords.
> I want to set dgNumberOfRecords so the records
> are displayed dynamically like is done in the sample
> stack for displaying a large number of records.
> Am I supposed to set up the GetDataForLine or the
> dgNumberOfRecords in my data grid somehow?
> When I set dgNumberOfRecords nothing else happens
> and any script after that does not work either.
> Anyone have a clue why it stops or a different stack that
> shows how to use it properly?
> John Balgenorth
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the use-livecode mailing list