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

A question for "(Eval(Eval Expr(Sum(Expr(sumCol))))== N Items(sumCol)=> 1" statement.

Dear Sir,

 

I am debugging an if statement like the one below.  I am wondering what does it evaluate on and if it would generate "1" from the unknown state of "(Eval(Eval Expr(Sum(Expr(sumCol))))== N Items(sumCol)"

johnj_wang1_0-1629904172990.png

Please let me know.

 

Thanks,

John

2 REPLIES 2
jthi
Super User

Re: A question for "(Eval(Eval Expr(Sum(Expr(sumCol))))== N Items(sumCol)=> 1" statement.

Strong suggestion to check out this great post about Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute .

 

Names Default To Here(1);

sumCol = [1,1,1]; 
//check in parts
Show(Eval Expr(Sum(Expr(sumCol))));
Show(Eval(Eval Expr(Sum(Expr(sumCol)))));
Show(N Items(sumCol));
Show(If(Eval(Eval Expr(Sum(Expr(sumCol))))== N Items(sumCol),1,0));

 

-Jarmo
vince_faller
Super User (Alumni)

Re: A question for "(Eval(Eval Expr(Sum(Expr(sumCol))))== N Items(sumCol)=> 1" statement.

Do you have any idea what you're actually trying to do?  

My guess is you have a script making that and people tried to put in the variable `sumCol` into the formula.  with something like 

 

Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
sumCol = dt:weight << Get Values();
dt << New Column("test", Formula(if(Eval(EvalExpr(Sum(Expr(sumCol))))==Nitems(sumCol), 1, 0)));

// What I think you'd want to do is 

Eval(EvalExpr(
	dt << New Column("Test 2", Formula(Sum(Expr(sumCol)) ==Nitems(Expr(sumCol))));
	// or
	dt << New Column("Test 3", Formula(
		fsumCol = Expr(sumCol);// this is just letting the formula know what it is
		Sum(fsumCol) == Nitems(fsumCol);
	));
));
// you don't need the if, 1, 0 because you're boolean will eval to 1 anyway. 
Vince Faller - Predictum