So I have to save from a grid where there are two types of IDs. LineId & CustId. There can be multiple CustIds for each LineId. An example of data would be like this:
LineId CustId
1 33
2 98
7 101
1 51
3 28
7 02
1 35
I need to save the code with a save procedure that accepts a null-delimited string of CustIds for each Line id. I call the save procedure once for each LineId being saved. I cannot change how the save procedure works.
So far I have been adding the grids to a type array with line id and cust id.
Dim typeRows(gridRows - 1) As Ids 'gridRows is rowcount of grid
For i = 0 To grid.Rows - 1
typeRows(i).LineId = grid.TextMatrix(i, GridColumns.colLineId)
typeRows(i).CustId = grid.TextMatrix(i, GridColumns.colCustId)
Next
But I’m a little stuck on what I should do next. Should I sort the grid? Then how would I go through the sorted grid and combine cust ids for each lineid?
Any help or guidance would be very appreciated.
without sorting the grid you have to loop through the array as well to check if the id was already found before, that can be done as well, but might take some time depending on the size of your data