How to select columns which start with specific names in JSL?Hello,
I have some problem when I want to select some specific columns.
If there have column header with "RD123", "RD345", "123RD"...etc.
I want to select the column only start with "RD", and the only script I know is below
dt = Current Data Table();
colList= dt << get column names( string );
For( i = 1, i <= N Items( colList ), i++,
If( Contains(colList [i], "RD")) << set selected)
);
How to modify the script to select only "RD123" and "RD345"?
Thanks.
Automation and ScriptingRe: How to select columns which start with specific names in JSL?You could use Starts With instead of Contains. Also it might be easier to first filter down to the list of columns of interest and then select those using << Select Columns. Below is one example
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
all_colnames = dt << Get Column Names("String");
cols_of_interest = Filter Each({col_name}, all_colnames, Starts With(col_name, "NPN"));
dt << Select Columns(cols_of_interest);Re: How to select columns which start with specific names in JSL?Thanks a lot!