Few questions:
- Do you wish to group all columns?
- Do your columns have clear separator for the group such as underscore (Raman_)
Names Default To Here(1);
dt = Current Data Table();
CL = dt << Get Column Names();
Raman = {};
For Each({value}, CL,
If(Starts With(value, "Raman"),
Insert Into(Raman, value);
);
);
dt << Group Columns("Raman", Raman);
And full example based on the examples I have
Names Default To Here(1);
dt = New Table("Untitled 2",
Add Rows(1),
Compress File When Saved(1),
New Column("Raman1", Numeric, "Continuous", Format("Best", 12), Set Values([.])),
New Column("Raman2", Numeric, "Continuous", Format("Best", 12), Set Values([.])),
New Column("XRD1", Numeric, "Continuous", Format("Best", 12), Set Values([.])),
New Column("Raman3", Numeric, "Continuous", Format("Best", 12), Set Values([.])),
New Column("XRD2", Numeric, "Continuous", Format("Best", 12), Set Values([.]))
);
collist = dt << Get Column Names("String");
aa_groups = Associative Array();
aa_groups["Raman"] = {};
aa_groups["XRD"] = {};
For Each({groupname}, aa_groups << get keys,
For Each({value}, collist,
If(Starts With(value, groupname),
Insert Into(aa_groups[groupname], value);
);
);
);
For Each({{groupname, cols}}, aa_groups,
dt << Group Columns(groupname, cols);
);
-Jarmo