Get value of Row Column in Datagrid

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
gagsoft
Posts: 168
Joined: Sat Jun 29, 2013 7:56 pm

Get value of Row Column in Datagrid

Post by gagsoft » Wed Sep 11, 2019 11:57 am

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?

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Get value of Row Column in Datagrid

Post by Klaus » Wed Sep 11, 2019 12:09 pm

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
...

gagsoft
Posts: 168
Joined: Sat Jun 29, 2013 7:56 pm

Re: Get value of Row Column in Datagrid

Post by gagsoft » Wed Sep 11, 2019 12:49 pm

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

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Get value of Row Column in Datagrid

Post by Klaus » Wed Sep 11, 2019 1:15 pm

Well, this is your line 2:
...
itemdel to TAB
...
Don't you think there is something missing? 8)

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Get value of Row Column in Datagrid

Post by bogs » Wed Sep 11, 2019 1:23 pm

<psssst....'set'...> :wink:
Image

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Get value of Row Column in Datagrid

Post by Klaus » Wed Sep 11, 2019 1:28 pm

Thanks a LOT for ruining my pedagogical approach! 8)

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Get value of Row Column in Datagrid

Post by bogs » Wed Sep 11, 2019 1:32 pm

Oooops :oops:
:twisted:
Image

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Get value of Row Column in Datagrid

Post by Klaus » Wed Sep 11, 2019 1:37 pm

Please don't (actively) support sloppiness!

Zryip TheSlug
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 163
Joined: Tue Jan 26, 2010 10:15 pm
Contact:

Re: Get value of Row Column in Datagrid

Post by Zryip TheSlug » Wed Sep 11, 2019 2:11 pm

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.
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel

gagsoft
Posts: 168
Joined: Sat Jun 29, 2013 7:56 pm

Re: Get value of Row Column in Datagrid

Post by gagsoft » Wed Sep 11, 2019 3:15 pm

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

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”