How to give multiple inputs for column selection in jslHi!
I'm trying to use the contains function to select multiple columns. After going through the scripting guide, I found an example which gave me a direction, but I don't know how to give multiple inputs. Here's the section of code I'm using:
dt = current data table();
colList = dt << Get Column Names(Numeric, "Continuous");
For( i = 1, i <= N Cols( dt ), i++,
If( Contains( colList[i],"NPT_IRST_"),
Column( colList[i] ) << Set Selected( 1 )
)
);
I need to give the following inputs: "NPT_IRST_" , "_NPT" and [ ( open square bracket). How do I give these three inputs?
Thanks!
Re: How to give multiple inputs for column selection in jslThank you so much for your help!!
As a quick followup, if I try to stack the selected columns in the above case, I'm using the following:
dt << stack(
column(colList),
Source Label Column( "Label" ),
Stacked Data Column( "Data" )
);
but for some reason, It doesn't stack the selected columns. Any suggestion on how to solve this?Re: How to give multiple inputs for column selection in jslYou can expand on the If() condition that you are evaluating, into the 3 comparisons you want. I believe the below code will get you what you need
Names Default To Here( 1 );
dt = Current Data Table();
colList = dt << Get Column Names( Numeric, "Continuous" );
For( i = 1, i <= N Cols( dt ), i++,
If( Contains( colList[i], "NPT_IRST_" ) |
Contains( colList[i], "_NPT" ) |
Contains( colList[i], "[" )
,
Column( colList[i] ) << Set Selected( 1 )
)
);