Is this what you are looking for???
names default to here(1);
dt=current data table();
// The list of columns to look for
theList={"Class","Student","Subject", "xxxxxx","xxxxxx"};
allColList = dt << get column names(string);
// Remove any columns from theList that are not in the data table
For(i=n items(theList),i>=1, i--,
If(n rows(loc(allColList,theList[i]))==0,
remove from(theList,i,1)
)
);
// Run the tabulate
Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Analysis Columns( :Marks ), Statistics( Max ) ),
Row Table( Grouping Columns( eval(theList) ) )
)
);
If the different target columns play roles other than Grouping Columns, you will need to develop the code accounting for the different required input syntax.
Jim