BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
kuannygoh
Occasional Contributor

unable to eval a formula in a table

Hi all , 

 I am trying to eval a expression in a formula but it seems to have error, can someone help me ? 

 

My formula is below:

		dtmaster << New Column("_SBL",
			Numeric,
			Formula(
				 (Match( :Selected_Sigma,
					"Flag_3Sigma",Eval expr(((column(8)- column(6)) / 3) * 3 + column(6)),
					"Flag_4Sigma",Eval expr( ((column(8)- column(6)) / 3) * 4 + column(6)),
					"Flag_5Sigma",Eval expr(((column(8)- column(6)) / 3) * 5 + column(6)),
					"Flag_6Sigma",Eval expr(((column(8)- column(6)) / 3) * 6 + column(6))
				))) 
			,
			Format( "Percent", 12, 2 )
		) 

 jsl image.PNG

0 Kudos
6 REPLIES 6
uday_guntupalli
Community Trekker

Re: unable to eval a formula in a table

@kuannygoh , 
      May I ask why you are trying to using eval function ? What are you actually trying to achieve ?
      If you absolutely want to use the Eval Expr, kindly take a look at the scripting index ecample shown below:

 

image.png

Best
Uday
Craige_Hales
Staff (Retired)

Re: unable to eval a formula in a table

yes, try removing the EvalExpr. It isn't needed and is causing at least part of the problem you are seeing.

Craige
kuannygoh
Occasional Contributor

Re: unable to eval a formula in a table

Hi I tried removed, but it still shows error. I am trying to match the column of selected sigma with formula.
0 Kudos
kuannygoh
Occasional Contributor

Re: unable to eval a formula in a table

I am trying to match the column of selected sigma with formula.
0 Kudos
kuannygoh
Occasional Contributor

Re: unable to eval a formula in a table

Hi, the error shown is as attached in image
0 Kudos
Craige_Hales
Staff (Retired)

Re: unable to eval a formula in a table

dt = Open( "$sample_data/big class.jmp" );

dt << New Column( "H_OR_W",
	Numeric,
	Formula(
		(Match( :sex,
			"F", height, // height
			"M",
				Column( 5 )[] // weight
		))
	),
	Format( "Percent", 12, 2 )
);

if you use an explicit column name, like height, above, then JMP knows to index with the current row. If you use the column function to specify the column, you still need to index into the column. You can use the empty subscript shown above to tell JMP to use the current row. See the weight example above.

Craige