I have a datawindow with 30 columns populated with some data. I want to move to right each value with one position. Basically I want to copy the value from column 29 into column 28, the value from column 27 into column 28 and so on. How can I achieve this? Is there any PB function for shifting values in a datawindow?
First off, are all the columns the same type? (char, date, number,etc.) If they are you could do something like
int i
long ll
string ls_val
FOR ll = 1 TO dwname.rowcount()
i = 1
DO WHILE i < 30
//assumes columns are all char
ls_val = dwname.getitemstring(ll, i + 1)
dwname.setitem(ll,i,ls_val)
i++
LOOP
NEXT
Now doing this will change the itemstatus and rowstatus for every row and column in the datawindow. If that matters you will need to reset them.
If the columns are different datatypes you have a whole bunch of work to do and I would question why you are trying to do this in the first place. Re designing the datawindow would probably be a better choice.