How to use an array to solve the following...
Bob Sneidar
bobs at twft.com
Mon Feb 20 16:23:42 EST 2012
ON mouseUp pMouseBtnNo
put the dgData of group "dgTableData" into theDataA
REPEAT FOR each element theRecordA in theDataA
add 1 to theItemNum
put theRecordA["reservationid"] into item theItemNum of theReservationList
END REPEAT
put theReservationList
END mouseUp
I have a datagrid of meeting reservations. There are 25 rows. It contains a column called reservationid. Given that, when done the message contains this:
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25
Note that datagrid data is a numbered array, each element of which is another array, each element of which corresponds to a column in the datagrid. Note also that were I to try to alter the contents of theDataA inside the repeat loop the results would be unreliable for the reasons mentioned before.
Using your method of getting the keys first and then using repeat for each line in theKeyList has the advantage that you can alter the contents of the array itself without a problem.
Bob
On Feb 20, 2012, at 1:06 PM, mikedoub at gmail.com wrote:
> Bob,
>
> Can you give a quick example of this? I have always used for each line in the keys of array.
>
> Thanks
> Mike
> Sent from my BlackBerry device on the Rogers Wireless Network
More information about the use-livecode
mailing list