Sorry for the late response. Thanks @jthi !
I found that the following works for what I want to do:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
new_col_expr = expr(
dt << new column("Testing",formula(t1+t2+3))
);
Selection1 = {1,5};
if(Selection1[1] == 1,
Substitute into(new_col_expr,
expr(t1),
Selection1[2]
),
Selection1[1] == 0,
Substitute into(new_col_expr,
expr(t1),
Nameexpr(ascolumn(Selection1[2]))
)
);
Selection2 = {0,"weight"};
if(Selection2[1] == 1,
Substitute into(new_col_expr,
expr(t2),
Selection1[2]
),
Selection2[1] == 0,
Substitute into(new_col_expr,
expr(t2),
Nameexpr(ascolumn(Selection2[2]))
)
);
eval(evalexpr(new_col_expr))
Thanks for all the reference above though. They helped.
Happy New Year!