moving column named via string variable to after another column also named via string variableHow do I move a column referenced by a string variable to after another column also referenced by a string variable in table st
zzz = Column(cnm);
colst = {zzz};
Eval(Eval Expr(Expr(st<
my Locals show that
Variable cnm has the Value "ppg 1000" of type String
Variable yyy has the Value Column("lxt 1000") of type Column
Variable zzz has the Value Column("ppg 1000") of type Column
Variable colst has the Value {zzz} of type List
Thought I would need to use Eval, Eval Expr, Expr, etc to get this to work, but cannot seem to get it right.
Please help. Thanks in advance.
Cheers
Galactus3000
Re: moving column named via string variable to after another column also named via string variableonly do the expr around the colst. if you're doing an evalExpr() around a whole expr(), you're effectively doing nothing.
Eval(EvalExpr(dt << MoveSelectedColumns(Expr(colst), After(yyy))))
it's probably a good idea to do:
colst = Evallist({zzz});
unless you're trying to have colst be a list of references instead of a list of columns
Re: moving column named via string variable to after another column also named via string variableHere's another way that builds a string dynamically and then executes it via eval(parse()).
st = New Table( "Untitled", Add Rows( 2 ),
New Column( "lxt 1000", Character, "Nominal", Set Values( {"a", "b"} ) ),
New Column( "Column 2", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [1, 2] )
),
New Column( "ppg 1000", Numeric, "Continuous", Format( "Best", 12 ),
Set Values( [3, 4] )
)
);
wait(2);
cnm = "ppg 1000";
yyy = "lxt 1000";
move_expr = evalinsert("\[st << Move Selected Columns({"^cnm^"}, After("^yyy^"))]\");
eval(parse(move_expr));Re: moving column named via string variable to after another column also named via string variableHere's one way:
NamesDefaultToHere(1);
dt = NewTable("MoveColumns");
dt << addMultipleColumns("Column ", 10, AfterLast, Numeric);
Wait(2);
cols = dt << getColumnNames("String");
RemoveFrom(cols, 8, 3);
afterCol = "Column 08";
moveCMD = Expr(dt << moveSelectedColumns(colsTBD, After(afterColTBD)));
SubstituteInto(moveCMD, Expr(colsTBD), cols, Expr(afterColTBD), afterCol);
moveCMD