cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Feli
Level IV

Calling column from column list in formula

I'm quite sure I will feel stupid after seeing the answers but I currently have a brain hang up.

 

I want to refer to a column from a list of columns in a new formula in JSL (for later looping over the list).

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

mylist= dt<< Get Column Names();

dt << New Column( "myCol",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	Formula(:height * mylist[1] )
);

mylist[1] should later be the first column of the column list. I'm guessing I should wrap the list reference in an Expr() or Eval Expr(), but the functioning syntax escapes me at the moment.

 

Any help?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Calling column from column list in formula

2 REPLIES 2
jthi
Super User

Re: Calling column from column list in formula

I'm fairly sure this post will help you solve the problem Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute .

-Jarmo
Feli
Level IV

Re: Calling column from column list in formula

The substitute was exactly was I was looking for, thank you!