I'm working to group several thousand columns together by name that matches with something from a list of values from an initial column
example:
Col1 values = {step1, step2, step3}
Col2:5000 names :step1_blahblahblah, step2_blahblbahblah, etc
I guess I'm not quite sure how to define the if(contain) statement uses the list of values from Col1.
dt = current data table();
Summarize( dt, StepIDIndex= by( :RecipeStepId) );//get list of unique RecipeStepID's
colNamesList = dt << get column names(string, continuous); //get all the column names
StepList = {}; //Create an empty list for the matching columns
// Find matching column names
For( i = 1, i <= N Items( colNamesList ), i++,
If(
contains( colNamesList[i], StepIDIndex),
Insert Into( StepList , colNamesList[i] )
)
);
// If groups of columns are found, create col groupings
If( N Items( StepList ) > 0,
dt<< select columns( StepList );
dt<< group columns();
);