script to add two columni am trying to add two columns.
two of the column has name abcd and efgh
following line works:
dt_tab << New Column( newcolumn, formula(:name("abcd") + :name("efgh"));
but following code is throwing an error
name1 = "abcd";
name2 ="efgh";
dt_tab << New Column( name1 || "3", formula(:name(name1) + :name(name2));
why is the 2nd method not working?
ScriptingRe: script to add two columnThe reason this is not working, is that neither the :Name() function nor the Formula() element does not parse the contents of the function before execution. You need to create the exact JSL before execution
name1 = "abcd";
name2 = "efgh";
Eval(
Substitute(
Expr(
dt_tab << New Column( name1 || "3",
formula( Column( __name1__ ) ) + Column( __name2__ )
)
),
Expr( __name1__ ), name1,
Expr( __name2__ ), name2
)
);