This website uses Cookies. Click Accept to agree to our website's cookie use as described in our Privacy Policy. Click Preferences to customize your cookie settings.

- JMP User Community
- :
- Discussions
- :
- Suppress Eval all column formula

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

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.

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content

Created:
Jan 17, 2022 10:54 PM
| Last Modified: Jun 10, 2023 07:42 PM
(475 views)

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 ))
)
)
);
```

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content

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

1 REPLY 1

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content

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

- © 2024 JMP Statistical Discovery LLC. All Rights Reserved.
- Terms of Use
- Privacy Statement
- About JMP
- JMP Software
- JMP User Community
- Contact