gotchya. I figured out how to get both versions to work! Big thanks and kudos.
For anyone in the future, here's my finished versions:
V1=
//**split Aggregate Data from TALL to WIDE, grouping WIDE columns by StepID
dt = current data table();
//Build and prefill an Array of names of the RecipeStepId
Summarize( dt, RecipeStepIndex = by( :RecipeStepId) );//get list of unique RecipeStepID's
aa_groups = Associative Array(RecipeStepIndex, Repeat({{}}, N Items(RecipeStepIndex)));
//split the table TALL to WIDE
dt << Split(
Split By( :RecipeStepId, :ParameterName, :AggregateFunction ),
Split( :Value ),
Group( :Recipe, :ProcessTime, :Tool, :Chamber, :Lot, :WaferScribe ),
Output Table( "AggWide" ),
Remaining Columns( Drop All ),
Sort by Column Property,
dt << sort( by( :Recipe, :Tool, :Chamber, :Lot, :WaferScribe ))
);
//Group the Cols by name of RecipeStepId
col_list = dtAggWIDE << Get Column Names("String"); //get the col list
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
If(!Contains(aa_groups, col_group),
aa_groups[col_group] = Eval List({col_name});
,
Insert Into(aa_groups[col_group], col_name);
);
);
For Each({{key, value}}, aa_groups, //perform the grouping
dtAggWide << Group Columns(key, value);
);
V2=
//**split Aggregate Data from TALL to WIDE, grouping WIDE columns by StepID
dt = current data table();
//Build and prefill an Array of names of the RecipeStepId
Summarize( dt, RecipeStepIndex = by( :RecipeStepId) );//get list of unique RecipeStepID's
aa_groups = Associative Array();
//split the table TALL to WIDE
dt << Split(
Split By( :RecipeStepId, :ParameterName, :AggregateFunction ),
Split( :Value ),
Group( :Recipe, :ProcessTime, :Tool, :Chamber, :Lot, :WaferScribe ),
Output Table( "AggWide" ),
Remaining Columns( Drop All ),
Sort by Column Property,
dt << sort( by( :Recipe, :Tool, :Chamber, :Lot, :WaferScribe ))
);
//Group the Cols by name of RecipeStepId
col_list = dtAggWide << Get Column Names("String");
For Each({col_name}, col_list,
col_group = Word(1, col_name, " ");
If(!Contains(aa_groups, col_group),
aa_groups[col_group] = {};
);
Insert Into(aa_groups[col_group], col_name)
);
For Each({{key, value}}, aa_groups, //perform the grouping
dtAggWide << Group Columns(key, value);
);