Page 1 of 1
Datagrid Get Column Value
Posted: Wed Feb 26, 2014 2:41 am
by blairetabay
hi to all,
i have a serious problem regarding with the datagrid.
i need to the values inside my datagrid per column in an array form i have a sample code but it returns it just give me the row name not the row value
datagrid name is dgGrid
recNum is the row name in my datagrid
Code: Select all
put the getDataOfIndex of the group "dgGrid" into tDataRow
put tDataRow, "recNum " into valueFromrecNum
answer valueFromrecNum
thank you in advance
blaireTabay
Re: Datagrid Get Column Value
Posted: Wed Feb 26, 2014 5:19 am
by Simon
Just to show I'm not really crazy;
Code: Select all
on mouseUp
put the dgData of group "dgGrid" into theDataA
put the dgIndexes of group "dgGrid" into theIndexes
repeat for each item theIndex in theIndexes
put theDataA[theIndex]["recNum"] & cr after tRecords
end repeat
breakpoint
end mouseUp
Figured that out from here;
http://lessons.runrev.com/s/lessons/m/d ... -data-grid
Simon
Edit; OK from your previous post this can you figure out how to put the data into a field on another card/stack and print it?
Re: Datagrid Get Column Value
Posted: Wed Feb 26, 2014 7:24 am
by blairetabay
Simon
Thank you it really help me
although it loop the entire row now i want it to show the message in just one click. in your example it will loop every column. Here is my code am I doing the right thing in showing the message?
Code: Select all
put the dgData of group "dgGrid" into theDataA
put the dgIndexes of group "dgGrid" into theIndexes
repeat for each item theIndex in theIndexes
put "PatientName" & cr after tRecords
put theDataA[theIndex]["recNum"] & cr after tRecords
# answer tRecords
end repeat
# answer tRecords
breakpoint
# answer tRecords
the result is still the same i put the answer out the repeat but still looping do you have any suggestion for this? what should i do?
blaireTabay
Re: Datagrid Get Column Value
Posted: Wed Feb 26, 2014 8:14 am
by Simon
Hi blaireTabay,
I'm glad that helped you.
Again I am sorry, I do not understand your request.
I take it English is not your native language.
Have you done the DataGrid lessons here?
http://lessons.runrev.com/m/datagrid
Simon
Re: Datagrid Get Column Value
Posted: Wed Feb 26, 2014 8:39 am
by bangkok
Code: Select all
on mouseUP
put the dgHilitedLines of me into theLine
answer GetDataOfLine(theLine, "PatientName")&" "&GetDataOfLine(theLine, "recNum")
end mouseUP
Re: Datagrid Get Column Value
Posted: Wed Feb 26, 2014 2:08 pm
by Klaus
Hi Blaire,
datagrids wortk with ARRAYS most of the time and also here with "dgDataOfIndex",
so you need to use the ARRAY syntax to address the contents of an array.
I think this is what you are after:
## Since I do not know WHAT row exactlyyou want to address, I use the currently hilited line
## of the datagrid as the desired row.
...
put the dgHilitedIndex of grp "dgGrid" into tCurrentRow
put the dgDataOfIndex[tCurrentRow] of group "dgGrid" into tData
## tData now contains an ARRAY, so use the array syntay (the one with []) to get the KEY you want:
put tData["recNum"] into valueFromrecNum
answer valueFromrecNum
...
Best
Klaus