I just can't get this to work.
I'm trying to get the contents of a datagrid cell from a column, where I use a variable to define the actual column.
This is the problem I'm having:
put 2 into tnumbera
put quote & "Col" & tnumbera & quote into tcola
put theDataA[tcola]
theDataA is the line data of a datagrid
If I use put theDataA["Col2"] ..... it returns the right value
but if I use put theDataA[tcola] ....... it doesn't return anything
Any idea what I am doing wrong ?
Kev
Selecting a Datagrid column using a variable
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 163
- Joined: Tue Jan 26, 2010 10:15 pm
- Contact:
Re: Selecting a Datagrid column using a variable
Hi Kev,DukeUK wrote:I just can't get this to work.
I'm trying to get the contents of a datagrid cell from a column, where I use a variable to define the actual column.
This is the problem I'm having:
put 2 into tnumbera
put quote & "Col" & tnumbera & quote into tcola
put theDataA[tcola]
theDataA is the line data of a datagrid
If I use put theDataA["Col2"] ..... it returns the right value
but if I use put theDataA[tcola] ....... it doesn't return anything
Any idea what I am doing wrong ?
I think the problem should be on the line:
Code: Select all
put quote & "Col" & tnumbera & quote into tcola

Code: Select all
put 2 into tnumbera
put "Col" & tnumbera into tcola
put theDataA[tcola]
http://lessons.runrev.com/s/lessons/m/d ... or-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
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
Re: Selecting a Datagrid column using a variable
Many thanks
Yes without the quotes it all works fine.
Kev
Yes without the quotes it all works fine.
Kev