Data Grid - getting current line data

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
PeterJ
Posts: 2
Joined: Mon Feb 15, 2010 11:08 am

Data Grid - getting current line data

Post by PeterJ » Mon Feb 15, 2010 11:23 am

I am starting out with Revolution and I want to use Data Grids with a mySQL database. I have created a data grid on a card and put the following into the data grid group:
getProp uSelectedID
put the dgHilitedLines of me into theLine
put the dgDataOfLine[theLine] of me into myArray
put myArray["SuitcaseName"] into myAmount
return myAmount
end uSelectedID
Looking at the values in debug, I get a value of 2 for theLine, but myArray remains blank.

I assume that I have missed something somewhere, but what?

Any help would be appreciated.

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Re: Data Grid - getting current line data

Post by trevordevore » Mon Feb 15, 2010 3:26 pm

Your code looks right. If you print off the data in the Data Grid what does it look like?

How Can I See What The Data Grid's Internal Array Currently Looks Like?
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

PeterJ
Posts: 2
Joined: Mon Feb 15, 2010 11:08 am

Re: Data Grid - getting current line data

Post by PeterJ » Mon Feb 15, 2010 5:08 pm

Thanks.

I have printed the contents and saw my mistake - I was not using the correct name for the field (I was using the column header as displayed rather than the column name!) What put me off the track of finding this was that the variables pane in debug mode was showing myArray a empty.

1
SCColour: `Black`
SCID: `1`
SCMake: `Tumi`
SCName: `Large Suiter`
2
SCColour: `Grey`
SCID: `2`
SCMake: `Delsey`
SCName: `Medium Suiter`
3
SCColour: `Grey`
SCID: `3`
SCMake: `Delsey`
SCName: `Small Suiter`


Again thanks for your help - I will press on with my learning.

Post Reply