Using Arrays

Mike Bonner bonnmike at gmail.com
Fri Jun 3 21:41:06 EDT 2011


Forgot to mention, once you adjust the array you can then set the datagrid
to the new values by setting the dgdata of group "yourgrid" to tArray.

Depending on what you're doing, it may be more efficient to just update
values directly in the datagrid.  Here are some base links to datagrid
lessons that are pretty helpful, as well as the datagrid api info.

http://lessons.runrev.com/spaces/lessons/manuals/datagrid

http://lessons.runrev.com/spaces/lessons/manuals/datagrid_tips


On Fri, Jun 3, 2011 at 7:36 PM, Mike Bonner <bonnmike at gmail.com> wrote:

> dgtext isn't an array value, to do what you want you need to get the dgdata
>
> For example, if you have a simple table grid with 2 columns, col1 and col2
> with 3 records, to get the array back out do
>
> *get the dgdata of group "yourdatagridgroupname" *
> *put it into tArray*
>
> At this point, knowing whats in the grid if you
>
> *put the keys of tArray*
> since there are 3 records, the keys will be 1, 2 and 3 will be displayed in
> the message box. If you then *put the keys of tArray[1]* you will see the
> column keys, col1 and col2, so to get a specific cell is as you've been
> trying to do with the dgtext  tarray[1]["col1"] will get the data from row 1
> col 1.
>
> if you get the dgtext, it should react like a tab delimited flat file.  So
> if you
>
> *get the dgtext of group "mydatagridgroup"*
> *put it*
>
> it should display all rows and columns of the datagrid in the message box
>
> On Fri, Jun 3, 2011 at 7:09 PM, Van Brollini <analog_test at runbox.com>wrote:
>
>> I have a datagrid of 1250 by 28 that has been successfully uploaded during
>> the creation of the datagrid.
>>
>> I can use this line
>> put the dgText of group "DGTester" into tArray
>> to move the datagrid into an array.  During debug process with breakpoint,
>> this is successful.
>>
>> Now when I try to read, modify, compute results I get nothing.
>>
>> I have used get tArray[1][16] to query the array and get NULL.
>> I have tried to put "3.79e-6" into tArray[1][16] and the whole array ends
>> up NULL.
>>
>> What do I need to do to access individual elements of the array, modify
>> them and put their answers back into the array.  In C this is a piece of
>> cake, however, LiveCode is not releasing her secrets to me as yet.
>>
>> Thanks
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>



More information about the use-livecode mailing list