get rows in between characters from a column then move other column value (selected row only) to other columnHi,
I want to move or copy paste multiple column value of selected rows to other columns in the same table like picture below
the interested rows are always start from :Item == "start" until :Item == "values", but the total rows can be different. I want to copy paste or move value in Col1 and Col2 of the interested rows to Col 3 and Col 4. My current thought is to manually create a list that include the string from start to values under :Item then create a column to label as "1" if :Item contains list. from there set the Col 3 == Col 1 and Col 4 = Col 2.
However, the rows between start and values can be different. I wonder if anyone know better method to do the task without the need of manually create the list, but based on the "start" and "values" to find the rows.
original table

after moved

Automation and ScriptingRe: get rows in between characters from a column then move other column value (selected row only) to other columnI suspect it would be easier to manually do the cut and paste rather than having to create start and stop lists.
Re: get rows in between characters from a column then move other column value (selected row only) to other columnbut the purpose is for daily automation and the rows between the start and values can change from time to time.
Re: get rows in between characters from a column then move other column value (selected row only) to other columnThen I would make it as straight forward as possible and create a config table something like

Which makes your JSL pretty simple, something like:
Names Default To Here( 1 );
dt = Current Data Table();
dtConfig = Data Table( "Config" );
For( i = 1, i <= N Rows( dtConfig ), i++,
frCol = dtConfig:From Column[i];
toCol = dtConfig:To Column[i];
For( k = dtConfig:Start Row[i], k <= dtConfig:End Row[i], k++,
Column( dt:toCol )[k] = Column( dt, FromCol )[k];
If( dtConfig:Move_Copy == "Move",
Column( dt, FromCol ) = ""
);
);
);
Re: get rows in between characters from a column then move other column value (selected row only) to other columnI think you can safely do it without a config table. This checks to make sure that Col 1 contains a value in the "start" row before overwriting anything. Yes, I like using For Each().
Names Default To Here( 1 );
starts = Loc( dt:Item << Get Values, "start" );
ends = Loc( dt:Item << Get Values, "values" );
For Each( {v, i}, starts,
If( :Col 1[v] != "",
For Each( {val, idx}, v :: ends[i],
:Col 3[val] = :Col 1[val];
:Col 4[val] = :Col 2[val];
:Col 1[val] = "";
:Col 2[val] = "";
)
)
);