cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Djtjhin
Level IV

Suppress Eval all column formula

I was trying to use the script below to suppress eval or allow eval for all column formula in the table. For some reason, I kept getting an error (see snapshot) on the third time running the script but I can't particularly find the bug. Appreciate the community help in debugging this. 

 

names default to here(1);

dt = current data table();

try(formula_suppress = dt:Formula_Suppress,
	dt << set table variable("Formula_Suppress",1);
	formula_suppress = 1;
);
wait(0.5);

formula_suppress = abs(formula_suppress - 1);
dt << set table variable("Formula_Suppress",formula_suppress);
//show(formula_suppres);

for(i=1,i<=ncol(dt),i++,
	as column(dt,i) << suppress eval(formula_suppress)
);

if(formula_suppress == 1,
	status = "Suppressed",
	status = "Evaluated"
);

NewWindow("Alert",
	showToolbars(0),showMenu(0),BorderBox(top(15),bottom(15),left(15),right(15),
		VListBox(
			TextBox("Formulas in the table are " || char(status),<<setFontStyle("bold"),<<fontcolor("red")),
			SpacerBox(size(0,15)),
		HCenterBox(ButtonBox("         close         ",current window()<<close window ))
		)
	)
);

Djtjhin_0-1642478016718.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Suppress Eval all column formula

The syntax error that was causing the failure was because the 

formula_suppress = dt:Formula_Suppress,

was not returning what you were expecting.  Below is a rework of the code that returns properly when the Table Variable does not exist

names default to here(1);

dt = current data table();

if(try(isempty(dt:Formula_Suppress),1) == 1,
	dt << set table variable("Formula_Suppress",1);
	formula_suppress = 1;
);
wait(0.5);

formula_suppress = abs(formula_suppress - 1);
dt << set table variable("Formula_Suppress",formula_suppress);
//show(formula_suppres);

for(i=1,i<=ncol(dt),i++,
	as column(dt,i) << suppress eval(formula_suppress)
);

if(formula_suppress == 1,
	status = "Suppressed",
	status = "Evaluated"
);

NewWindow("Alert",
	showToolbars(0),showMenu(0),BorderBox(top(15),bottom(15),left(15),right(15),
		VListBox(
			TextBox("Formulas in the table are " || char(status),<<setFontStyle("bold"),<<fontcolor("red")),
			SpacerBox(size(0,15)),
		HCenterBox(ButtonBox("         close         ",current window()<<close window ))
		)
	)
);
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Suppress Eval all column formula

The syntax error that was causing the failure was because the 

formula_suppress = dt:Formula_Suppress,

was not returning what you were expecting.  Below is a rework of the code that returns properly when the Table Variable does not exist

names default to here(1);

dt = current data table();

if(try(isempty(dt:Formula_Suppress),1) == 1,
	dt << set table variable("Formula_Suppress",1);
	formula_suppress = 1;
);
wait(0.5);

formula_suppress = abs(formula_suppress - 1);
dt << set table variable("Formula_Suppress",formula_suppress);
//show(formula_suppres);

for(i=1,i<=ncol(dt),i++,
	as column(dt,i) << suppress eval(formula_suppress)
);

if(formula_suppress == 1,
	status = "Suppressed",
	status = "Evaluated"
);

NewWindow("Alert",
	showToolbars(0),showMenu(0),BorderBox(top(15),bottom(15),left(15),right(15),
		VListBox(
			TextBox("Formulas in the table are " || char(status),<<setFontStyle("bold"),<<fontcolor("red")),
			SpacerBox(size(0,15)),
		HCenterBox(ButtonBox("         close         ",current window()<<close window ))
		)
	)
);
Jim