Page 1 of 1

Get value of Row Column in Datagrid

Posted: Wed Sep 11, 2019 11:57 am
by gagsoft
I want to get the value of a row column of a datagrid.
The value I will want to get will always be at the same Row Column of the datagrid "European Currency Conversion table"
Row 1 Column 41 for The ZAR SA Rand currency.
I can only find references to mouse Datagrid click behaviours.

Does anybody know how to doe this?

Re: Get value of Row Column in Datagrid

Posted: Wed Sep 11, 2019 12:09 pm
by Klaus
Is this a datagrid of type TABLE or FORM?
Where do you want to get that value?
I mean a button outside of the datagrid?

If you have a TABLE datagrid you will find the value in:

Code: Select all

...
set itemdel to TAB
put item 41 of line 1 of the dgtext of grp "European Currency Conversion table" into THE_VALUE
...

Re: Get value of Row Column in Datagrid

Posted: Wed Sep 11, 2019 12:49 pm
by gagsoft
Hi Klaus
Many thanks
It is a data grid of type Table
I Get "Compilation error at line 2 (Expression: Bad factor), Char 2"
Here is my script:
on mouseUp
itemdel to TAB
put item 41 of line 1 of the dgtext of grp "MyGrid" into tZAR
end mouseUp

Re: Get value of Row Column in Datagrid

Posted: Wed Sep 11, 2019 1:15 pm
by Klaus
Well, this is your line 2:
...
itemdel to TAB
...
Don't you think there is something missing? 8)

Re: Get value of Row Column in Datagrid

Posted: Wed Sep 11, 2019 1:23 pm
by bogs
<psssst....'set'...> :wink:

Re: Get value of Row Column in Datagrid

Posted: Wed Sep 11, 2019 1:28 pm
by Klaus
Thanks a LOT for ruining my pedagogical approach! 8)

Re: Get value of Row Column in Datagrid

Posted: Wed Sep 11, 2019 1:32 pm
by bogs
Oooops :oops:
:twisted:

Re: Get value of Row Column in Datagrid

Posted: Wed Sep 11, 2019 1:37 pm
by Klaus
Please don't (actively) support sloppiness!

Re: Get value of Row Column in Datagrid

Posted: Wed Sep 11, 2019 2:11 pm
by Zryip TheSlug
Another approach would consist in using the datagrid API
http://lessons.livecode.com/m/datagrid/ ... -or-column

Code: Select all

put 1 into theLine
put the dgDataOfLine[theLine] of group "European Currency Conversion table" into theDataA
put theDataA["Column 41 "] into THE_VALUE
Where "Column 41" is the name (not the label) of your column.

Re: Get value of Row Column in Datagrid

Posted: Wed Sep 11, 2019 3:15 pm
by gagsoft
Thanks all for comming to my rescue :D
In my defence, I had about 2 hours sleep last night. :lol:

You guys are so funny.
Many thanks
Peter G