Adding multiple lines to a Data Grid
Posted: Thu Aug 08, 2013 1:37 am
I am trying to add data to an existing data grid. The user would specify a text file with tab delimited data, and this data would then be appended to the data grid. The approach I took was to first put the data into a temporary data grid (MainGridTemp) and then put the data into an array and then use dispatch "AddData" to append the data to MainGrid. My code works up to the point of adding data from the file to the temp grid array, but it just puts a blank line into the final grid array.
Here is my code:
There may be a better/simpler approach to doing this...
Here is my code:
Code: Select all
--Get data from file
answer file ""
put empty into theData
put url ("file:" & it) into theData
if theData is empty then break
--put data in a temp (hidden) data grid
set the dgText of group "MainGridTemp" to theData
--put formatted data into an array
put the dgData of group "MainGridTemp" into gridArray
--add data to data grid
dispatch "AddData" to group "MainGrid" with gridArray