Choose Language Hide Translation Bar

How to evaluate the result of a dialog box

I created an "Update" button and when the button is clicked, "updateDeciles" script will run (see below). First, a dialog box will open, if the "Cancel" button is click, exit script; if the "OK" button, check the inputs and then continue the rest script. My script for "Cancel" doesn't work. I searched Script Guide and didn't find anwser. Any help will be appreciated.

Border Box(Button Box("Update",Eval(updateDeciles)))
updateDeciles = Expr(

"Submission Weights in Decile", variable1=EditNumber(),
"Hit Ratio% Weights in Decile", variable2=EditNumber(),

IF(Button(-1) = true, exit Script(?))

a = variable1
b = variable2

IF(a = "",throw("input submission weights"));
IF(b = "",throw("input HitRatio% weights"));
0 Kudos
Super User mpb
Super User

Re: How to evaluate the result of a dialog box

1. Throughout JMP when you want to say "if X is somevalue then ..." you need to use a double equal sign: if (X == somevalue, some code, some other code)
2. Before worrying about making your update button work you need to make sure you can make the dialog work.
3. Though it is tempting to think that you can get access to the values entered into the dialog by referencing variable1 and variable2 directly that's not how the dialog works. You need to write:
dlg = Dialog( your dialog stuff as written );
Then dlg contains a List. Do a show(dlg) to see what it looks like.
To access the values you are looking for you write things like:
if(dlg["Button"]==-1, throw("Cancelled");
a = dlg["variable1"];
if(ismissing(a),throw("input submission weights"))

Note that you need to use ismissing(a) to find out if a is missing.

For basics on Lists, start at p103 in the scripting docs (help>books>JMP scripting guide) and particularly look at p105, the section on subscripts.
For an example of accessing values from a (relatively) simple dialog look at p273-274 under "Details common to Dialog and Column Dialog"
0 Kudos
Super User

Re: How to evaluate the result of a dialog box

A coworker found the following little gem for accessing variables defined in dialog boxes. If you say:


Then the variables you have defined are available as globals. You don't have to parse through the dlg list to find things.
0 Kudos