I have data table with three columns. 1st column is 'workweek'. 2nd column is 'Qty'. 3rd column is 'Cum_Qty'.
In 'Cum_Qty' column, it value is ongoing sum of the previous row value in 'Qty' column until meet => 500.
If the row qty is => 500 in , the value will update as it in the 'cum_Qty'.
I need help to write JSL script to create a new column ('Cum_WW') that will concatenate the workweek numbers to indicate the corresponding 'Cum_Qty' is sum from workweek X to workweek Y in order to meet qty => 500. Afterward, delete the some rows.
Refer to attached file and explanation below for details.
Examples:
In workweek 2, the qty is 633 (> 500) in 'Qty'column, qty is 633 in 'Cum_Qty' (no sum of previous row values), in 'Cum_WW' will indicates workweek 2.
In workweek 3, the qty is 185 (< 500), it sums 185 (from workweek 3) + 633(from workweek 2) = 818, this value is updated in 'Cum_Qty' column, in 'Cum_WW' will indicate workweek 2_3.
In workweek 4, the qty is 130 (<500), it sums 130 (from workweek 4) + 185 (from workweek 3) + 633(from workweek 2) = 948, this value is updated in 'çum_Qty' column, in 'Cum_WW' will indicate workweek 2_4.
In workweek 5, the qty is 90 (<500), it sums 90 (from workweek 5) + 130 (from workweek 4) + 185 (from workweek 3) + 633(from workweek 2) = 1038, this value is updated in 'Cum_Qty' column, in 'Cum_WW' will indicate workweek 2_5.
and so on......
Afterwards, delete row in in 'Cum_WW' 2, 2_3, 2_4 and maintain the row of data in 'Cum_WW' 2_5….and so on….
Thanks for your help.