Trying to write a script to perform curve fitting based on user selected columns.
In the example below, the goal is to fit linear with X and Y based on :Group and/or :Type. User can select either or both columns and then run the script.

This is what I've got
dt1 = current datatable();
sc = dt1 << get selected Columns;
scn= column (sc) << get name;
show (sc);<BR />show (scn);
obj = dt1 <<FIT curve=""></FIT>// By (sn)
);In Log
show (sc); spits out: sc = {:Group, :Type};
show (scn); spits out; scn = "Group";
In Fit curves, neither "By (scn)" nor "By(sc)" can achieve the function of "By (:Group, :Type) or By(:Group).
What is the correct code to make this work?
Thanks!
One option would be to add Eval() around scn:
Names Default To Here(1);
dt1 = Current Data Table();
sc = dt1 << get selected Columns;
scn = Column(sc) << get name;
Show(sc);
Show(scn);
obj = dt1 << Fit Curve(
Y(:Y),
X(:X),
Fit linear,
By(Eval(scn))// By (sn)
);