I tried but cant get it work on a variant.
There are two column where the user chooses in a custom dialog box, and i assign them the names of lx,ly.
I need a new column with formula
Radius = SQRT((X^2)+(Y^2))
However, when i run it, althought the new column is created, JMP prompt me
"N Items() argument must be a list", and no formula created.
Appreciate if a kind soul can advice on which part is faulty. Thanks.
customDlg << CloseWindow;
lp = colListP << GetItems;
lx = colListX << GetItems;
ly = colListY << GetItems;
// Are the user selections viable?
if (NItems(lp) < 1,
Dialog("ERROR: Select one or more Parameter Columns", Button("OK")); Throw());
if (NItems(lx) != 1,
Dialog("ERROR: You need to select an X Column", Button("OK")); Throw(),
xVar = lx(1)
);
if (NItems(ly) != 1,
Dialog("ERROR: You need to select a Y Column", Button("OK")); Throw(),
yVar = ly(1)
);
// *********************************************************************************
// Build New Column with new formula
// *********************************************************************************
dt = Current Data Table();
a = Column(dt,xvar);
b = Column(dt,yvar);
colx = ;
coly = ;
nlist = N Items(a);
For( i = 1, i <= nlist, i++,
newColExpr = Expr(
dt << New Column( "Radius", Numeric,
Formula( Root((Power(Expr(a(i)),2)+Power(Expr(b(i)),2)),2 ) ) );
Eval( Eval Expr( newColExpr ) );
);
);
);