loop and concatenateI need to create a new column which is a concatenate of a set of column
I just hard code the column name as below ...
new column("Code","character",
formula(:deliver || :func_groupa || :func_groupb_h || :func_groupb_l || :micro firmware load
|| :micro module build || :micro setup)
);
however, I want to create a script that can get the number of column from that input file and start concatenate the value inside (same as above)
Re: loop and concatenateThank you so much ..
Re: loop and concatenateHere is one way to do what you want
names default to here( 1 );
// Open a sample data table
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Get all of the character columns for concatenating
colNames = dt << get column names(character,string);
// Build a command string that generates the JSL to create the column
theExpr = "dt << new column( \!"concat\!", character, formula( concat(:" || colNames[1];
For( i = 2, i <= N Items( colNames ), i++,
theExpr = theExpr || ",:" || colNames[i]
);
theExpr = theExpr || ")));";
// Run the command string
Eval( Parse( theExpr ) );