I have taken a different approach to solving your problem. Looping through the data, accumulating the data as you propose will become quite slow with a lot of columna and rows. Using builtin JMP functions will be much faster. Below is a script that transposes the data into a tall data table to do the processing, using the builtin Col Cumulative Sum() function, and then transposes the data back to the wide format after processing is done.
names default to here(1);
dt=current data table();
// Transform the data into a long table from the current wide table
// to allow for faster processing using the built in column function
// col cumulative sum()
dtStack = dt << Stack(
columns( :D300, :D200, :D100, :D50, :D10 ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Name( "Non-stacked columns" )(Keep( :Tool, :Column 13 ))
);
// Add a new column to insure an alphbetical ordering of the original
// data table
dtStack << New Column( "Row Number",
Character,
"Nominal",
Formula(
If( Lag( :Tool ) != :Tool,
counter = 0
);
counter = counter + 1;
result = Substr( "00", Length( Char( counter ) ) - 3 ) || Char( counter )
|| " " || :Label;
)
);
// Add the Cumulative Sum column
dtStack << New Column( "xx",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Col Cumulative Sum( :Data, :Tool ) ),
Set Selected
);
// Transpose the data back into a wide format
dtFinal = dtStack << Split(
Split By( :Row Number ),
Split( :Data, :Name( "xx" ) ),
Group( :Tool ),
Remaining Columns( Drop All ),
Sort by Column Property
);
// Close the nolonger needed stack data table
close(dtStack,nosave);
// Pass across the column names adjusting them back to the desired form
For( i = 2, i <= N Cols( dtFinal ), i++,
If(
Word( 1, Column( dtFinal, i ) << get name, " " ) == "Data",
Column( dtFinal, i ) << set name( Substr( Column( dtFinal, i ) << get name, 10 ) )
,
Word( 1, Column( dtFinal, i ) << get name, " " ) == "xx",
Column( dtFinal, i ) << set name( Substr( Column( dtFinal, i ) << get name, 8 ) || ">=" )
)
);
Jim