How to complete the concatenation of the looping table in the memory array and then generate the data table once?I use "Big Class.jmp" to explain the operation requirements:
I am following the code to complete, but the speed is slow.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "test", formula( :weight - :height ) );
dt << run formulas;
Wait( 0 );
For( i = 1, i <= N Row( dt ), i++,
d1 = New Table( "a",
Add Rows( dt[i, 6] + 1 ),
New Column( "name", Character, Nominal ),
New Column( "step", Continuous ),
New Column( "level", Continuous )
);
d1[1 :: N Row( d1 ), 1] = dt[i, 1];
Column( "step" ) << Formula( dt[i, 4] + (Row() - 1) );
d1 << run formulas;
Column( "step" ) << deleteFormula;
Column( "level" ) << Formula( If( Row() == dt[i, 6] + 1, 10, Ceiling( (Row()) / ((dt[i, 6] + 1) / 9.9) ) ) );
d1 << run formulas;
Column( "level" ) << deleteFormula;
If( i == 1,
d2 = Current Data Table(),
Current Data Table( dt );
d2 << Concatenate( Data Table( d1 ), Append to first table );
d1 << Close Window;
);
);
1. Create a new column "test" to calculate "weight"-"height"
2. Generate the new table according to the following requirements and splice them into the first generated new table:
Each new form has three columns: "name", "step" , and "level".The number of rows in the new table is the "test" value of each name obtained in the first step
"step" column is the data starting with "height", increasing by 1 for each row down and up to the "weight" row
"level" column: divide these rows evenly into 10 segments from small to large.The number of lines per paragraph may vary.
3. Splice the table one by one into a table.

How to complete the concatenation of the looping table in the memory array and then generate the data table once?
Thanks Experts!
Re: How to complete the concatenation of the looping table in the memory array and then generate the data table once?Rather than having to modify your code to steps that only use memory variables and matrices, my modification below, takes advantage of the "Private" option for Data Tables. It lets one create data tables that are non displayable. Thus, eliminating all of the overhead of the creation of the objects required to display them. My code reduced the processing time by at least half.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "test", formula( :weight - :height ) );
dt << run formulas;
Wait( 0 );
For( i = 1, i <= N Row( dt ), i++,
d1 = New Table( "a",
private,
Add Rows( dt[i, 6] + 1 ),
New Column( "name", Character, Nominal ),
New Column( "step", Continuous ),
New Column( "level", Continuous )
);
d1[1 :: N Row( d1 ), 1] = dt[i, 1];
Column( "step" ) << Formula( dt[i, 4] + (Row() - 1) );
d1 << run formulas;
Column( "step" ) << deleteFormula;
Column( "level" ) << Formula(
If( Row() == dt[i, 6] + 1,
10,
Ceiling( (Row()) / ((dt[i, 6] + 1) / 9.9) )
)
);
d1 << run formulas;
Column( "level" ) << deleteFormula;
If( i == 1,
d2 = d1,
Current Data Table( dt );
d2 << Concatenate( Data Table( d1 ), Append to first table );
Close(d1, nosave);
);
);
dtFinal = d2 << subset( selected rows( 0 ), selected columns( 0 ) );<BR />Close(d2,nosave);
Look in the Scripting Guide for information on the Private option
Re: How to complete the concatenation of the looping table in the memory array and then generate the data table once?private,
Thank Jim!