cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-412549%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3EUne%20question%20pour%20l'instruction%20%22(Eval(Eval%20Expr(Sum(Expr(sumCol))))%3D%3D%20N%20Items(sumCol)%3D%26gt%3B%201%22.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-412549%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3ECher%20Monsieur%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EJe%20d%C3%A9bogue%20une%20instruction%20if%20comme%20celle%20ci-dessous.Je%20me%20demande%20sur%20quoi%20%C3%A9value-t-il%20et%20s'il%20g%C3%A9n%C3%A9rerait%20%221%22%20%C3%A0%20partir%20de%20l'%C3%A9tat%20inconnu%20de%20%22(Eval(Eval%20Expr(Sum(Expr(sumCol))))%3D%3D%20N%20Items(sumCol)%22%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22johnj_wang1_0-1629904172990.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22johnj_wang1_0-1629904172990.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22johnj_wang1_0-1629904172990.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F35316i84E7C727314B3999%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22johnj_wang1_0-1629904172990.png%22%20alt%3D%22johnj_wang1_0-1629904172990.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ES'il%20vous%20pla%C3%AEt%2C%20faites-moi%20savoir.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMerci%2C%3C%2FP%3E%3CP%3EJohn%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-412549%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3EScript%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-412582%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Une%20question%20pour%20l'instruction%20%22(Eval(Eval%20Expr(Sum(Expr(sumCol))))%3D%3D%20N%20Items(sumCol)%3D%26gt%3B%201%22.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-412582%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EAvez-vous%20une%20id%C3%A9e%20de%20ce%20que%20vous%20essayez%20r%C3%A9ellement%20de%20faire%20%3F%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3EJe%20suppose%20que%20vous%20avez%20un%20script%20qui%20fait%20cela%20et%20que%20les%20gens%20ont%20essay%C3%A9%20de%20mettre%20la%20variable%20%22sumCol%22%20dans%20la%20formule.avec%20quelque%20chose%20comme%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20default%20to%20here(%201%20)%3B%0Adt%20%3D%20open(%22%24SAMPLE_DATA%5CBig%20Class.jmp%22)%3B%0AsumCol%20%3D%20dt%3Aweight%20%26lt%3B%26lt%3B%20Get%20Values()%3B%0Adt%20%26lt%3B%26lt%3B%20New%20Column(%22test%22%2C%20Formula(if(Eval(EvalExpr(Sum(Expr(sumCol))))%3D%3DNitems(sumCol)%2C%201%2C%200)))%3B%0A%0A%2F%2F%20What%20I%20think%20you'd%20want%20to%20do%20is%20%0A%0AEval(EvalExpr(%0A%20dt%20%26lt%3B%26lt%3B%20New%20Column(%22Test%202%22%2C%20Formula(Sum(Expr(sumCol))%20%3D%3DNitems(Expr(sumCol))))%3B%0A%20%2F%2F%20or%0A%20dt%20%26lt%3B%26lt%3B%20New%20Column(%22Test%203%22%2C%20Formula(%0A%20%20fsumCol%20%3D%20Expr(sumCol)%3B%2F%2F%20this%20is%20just%20letting%20the%20formula%20know%20what%20it%20is%0A%20%20Sum(fsumCol)%20%3D%3D%20Nitems(fsumCol)%3B%0A%20))%3B%0A))%3B%0A%2F%2F%20you%20don't%20need%20the%20if%2C%201%2C%200%20because%20you're%20boolean%20will%20eval%20to%201%20anyway.%20%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-412564%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3ERe%26nbsp%3B%3A%20Une%20question%20pour%20l'instruction%20%22(Eval(Eval%20Expr(Sum(Expr(sumCol))))%3D%3D%20N%20Items(sumCol)%3D%26gt%3B%201%22.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-412564%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3EForte%20suggestion%20de%20consulter%20cet%20excellent%20article%20sur%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2FJSL-Cookbook%2FInsert-one-expression-into-another-using-Eval-Insert-Eval-Expr%2Fta-p%2F48998%22%20target%3D%22_blank%22%3E%20Ins%C3%A9rer%20une%20expression%20dans%20une%20autre%20en%20utilisant%20Eval%20Insert%2C%20Eval%20Expr%2C%20Parse%20et%20Substitute%3C%2FA%3E%20.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(1)%3B%0A%0AsumCol%20%3D%20%5B1%2C1%2C1%5D%3B%20%0A%2F%2Fcheck%20in%20parts%0AShow(Eval%20Expr(Sum(Expr(sumCol))))%3B%0AShow(Eval(Eval%20Expr(Sum(Expr(sumCol)))))%3B%0AShow(N%20Items(sumCol))%3B%0AShow(If(Eval(Eval%20Expr(Sum(Expr(sumCol))))%3D%3D%20N%20Items(sumCol)%2C1%2C0))%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
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

Recommended Articles