I am really struggling with Data Grids.
If a line of data is selected in a data grid, how do I get a particular piece of data from one of the columns.
For example if i had this
Column 1 - Worker Type
Column 2 - Normal Cost Per Hour
Column 3 - After Hour Cost Per Hour
Column 4 - Weekend Cost Per Hour
If that row was selected, how would I get the data from column 4 and put it into a text field.
Get Data from another Column - Data Grid
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 5
- Joined: Wed Apr 17, 2013 3:53 pm
Re: Get Data from another Column - Data Grid
Hi.
Everyone struggles with datagrids until you get used to them. Then you struggle some more. But they are tremendous.
There are many ways to do this. Select a line in the DG. In a button script, try:
You can now extract whatever you want from that line.
Or, how about this for brevity:
Craig Newman
Everyone struggles with datagrids until you get used to them. Then you struggle some more. But they are tremendous.
There are many ways to do this. Select a line in the DG. In a button script, try:
Code: Select all
on mouseUp
put the dgHilitedLine of grp yourDG into tLine
get the dgDataOfline[tLine] of grp yourDG
combine it with return and tab
answer it
end mouseUp
Or, how about this for brevity:
Code: Select all
on mouseup
answer line (the dgHilitedLine of grp yourDG) of the dgText of grp yourDg
end mouseup
Re: Get Data from another Column - Data Grid
Put script:as your DataGrid group script (must change the name of DataGrid used in this script to the name of your DataGrid group).
It should do exactly what you asked.
Marek
Code: Select all
on dgMouseUp
local tLine
put the dgHilitedLine of grp "myDataGrid" into tLine
get the dgDataOfline[tLine] of grp "myDataGrid"
put it["Col 4"] into fld "myField"
end dgMouseUp
It should do exactly what you asked.
Marek