You've been trying to AddLine with a (broken) array. In your very first post you might have succeeded if you had a properly constructed array of data, and then instead of dispatching "AddLine", dispatching "AddData" would probably have worked.
You then went on to make an array, which you then used to populate the whole datagrid, which worked, but the AddLine part failed. That's why it looked like you were overwriting with the new line - it wasn't, but you had already recreated the entire datagrid contents with that single line of data.
Then you say you don't know how many rows there are in the datagrid to be able to insert a correct new line number, but you already got that in the first post.
When you add data with an array, the array index should not match the line number, when you set the whole datagrid contents using an array, each array index will be a new record of data. You need to pass the new line number but not by the array index.
Code: Select all
put tDate into theDataA[1]["date"]
put tFacility into theDataA[1]["facility"]
put tCategory into theDataA[1]["category"]
put fld "lblLink" into theDataA[1]["documentLink"]
put the dgNumberOfLines of grp "DataGridFiles1" of stack "Filing Cabinet" + 1 into theLineNo
dispatch "AddData" to grp "DataGridFiles1" of stack "Filing Cabinet" with theDataA, theLineNo
put the result into theNewIndex
You could alternatively do this with AddLine but that would need a tab delimited string, not an array. But in no case would you need to overwrite the dgData with an entirely new content.