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