Just found out that the citing of lstCols3 or lstCols2 as list of column names does not work either.
You can dynamically code the Stack Platform. Below is a simple example:
Names Default to Here(1);
dt=open("$SAMPLE_DATA/Semiconductor Capability.jmp");
Listcols={:NPN1, :PNP1, :PNP2, :NPN2};
lstCos3="Discriptors";
lstCos2="Values";
n=2;
Data Table( "semiconductor capability" ) << Stack(
columns( Listcols ),
Source Label Column( lstCos3 ),
Stacked Data Column( lstCos2 ),
Drop All Other Columns( 1 ),
Number of Series( eval(N) )
);
However, what I am picking up from your discussion is that you are thinking that Source Label Column, and Stacked Data Column, can be a list of names. The documentation below shows, that only a single name can be provided
Stacked Data Column
Assigns a name to the column that will contain the data for the stacked columns. The default name is Data. Leave the box empty if you do not want this column to appear in the new table.
Source Label Column
Assigns a name to the column that will contain the original table’s column names. The default name is Label. Leave the box empty if you do not want this column to appear in the new table.
If you need to have specific names for the Data and Label columns produced in the Stack Platform, you can simply change the names in the new table that is produced.
I was writing a script to stack bunch of columns togthers using JSL script like below. However, I am keeps getting error message that "Number of series should be a positive integer". I need the N to be variable depending on how many columns need to be stacked for different tables. I have other script to identify the number of column which works perfectly fine. Just the stack function somehow does not work.
dt_join2=current data table();
N=49
Data Table( dt_join2 ) << Stack(
columns(Lstcols ),
Source Label Column( lstCols3 ),
Stacked Data Column( lstCols2 ),
Number of Series(N)
);
@txnelson Many thanks the Eval() function make it work.