This snippet below is a portion of my script. At this point I have a data table and some of the cells on various rows have an extra special character in the 7th position...yeah weird dataset. Some don't. There are multiple rows and multiple columns, all of which can vary in count.
So I'm using a FOR loop to check the value of each cell for each row and column then trim or remove the 8th character if it has it. In fact, the script can simply do a left(dt,7) and I'd be happy with that. Where I'm at though is stuck because when I use the GETVALUES function then it puts the cell values for that column in a matrix and I can't figure out how to do the left trim. If I instead loop each row individually by removing the GETVALUES then I can trim the value properly but can't figure out how to force the new value into the cell. I have included both ways in the script below.
//Loop to delete the closing crazy characters from each row, it is always the 7th character that needs to be removed.
For(n = 1, n <= ncol(dtWAPFile), n++,
colname = Column(n) << get name;
For( k = 1, k <= N Rows( dtWAPFile ), k++,
RowVal = dtWAPFile:colname << GetValues; //This gets a matrix
NewRowVal = Left(RowVal,6); //This doesn't work with the matrix
dtWAPFile:colname << setvalues(NewRowVal);//This doesn't work...
);
For(n = 1, n <= ncol(dtWAPFile), n++,
colname = Column(n) << get name;
For( k = 1, k <= N Rows( dtWAPFile ), k++,
RowVal = dtWAPFile:colname[k]; //This gets the value for a row/column based on the loop
NewRowVal = Left(RowVal,6); //This trims the value
RowVal = setvalues(NewRowVal);//This doesn't work...can't seem to stuff it back in..
);