我正在努力按名稱將數千列分組在一起,該名稱與初始列的值列表中的某些內容相匹配
例子:
Col1 值 = {步驟 1, 步驟 2, 步驟 3}
Col2:5000 個名稱:step1_blahblahblah、step2_blahblbahblah 等
我想我不太確定如何使用 Col1 中的值列表來定義 if(contain) 語句。
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();
);