I am brand new to LiveCode. I've used Python and .NET in the past.
How can I loop through every element in a DataGrid, even if I don't know the column names?
Goal: Make a function to pre-process all cells in TSV that I have loaded into the grid. For example, perhaps I want to check for bad characters or fix formatting.
I want to emphasize it should be generic, ie- I don't know the column names or dimension.
I see this example in the help docs but it assumes I know the columns, which I do not:
Code: Select all
put the dgIndexes of group "DataGrid 1" into theIndexes
## Prefix XML
put "<people>" & cr into theXML
## Loop through data, putting into XML format
repeat for each item theIndex in theIndexes
put "<person>" & cr after theXML
put "<first_name>" & theDataA[theIndex]["FirstName"] & "</first_name>" & cr after theXML
put "<last_name>" & theDataA[theIndex]["LastName"] & "</last_name>" & cr after theXML
put "<title>" & theDataA[theIndex]["Title"] & "</title>" & cr after theXML
put "</person>" & cr after theXML
end repeat
## Close root XML tag
put "</people>" after theXML
Code: Select all
He said "hello" to me.
Code: Select all
"He said ""hello"" to me."
Thanks for your help, excited to get started with LiveCode.