cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
katief
Staff (Retired)

Get values from Modal New Window

I am having trouble getting values after I use a modal New Window Box.

If I run the example from the JMP 9 Scripting Guide:

New Window("Set a Value",<<Modal,

     TextBox("Set this Value"),

     variablebox = Number Edit Box(42),

     Button Box("OK"),

     Button Box("Cancel")

);

variablebox<<get;

I get this error: "Send Expects Scriptable Object in access or evaluation of 'Send', variablebox<<get

On the other hand:

When I run just the code

variablebox = Number Edit Box(42);

variablebox<<get;

I get:

42

Anyone know what I've done wrong here? I can't seem to make  "get" retrieve variables from any of the modal windows I've tried.

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Get values from Modal New Window

As soon Ok or Cancel is clicked, the reference is forgotten, and hence the error. Put the get command, or any script, inside the Ok-button to ensure that it will run before the modal window is history.

New Window( "Set a Value",

          <<Modal,

  Text Box( "Set this Value" ),

          variablebox = Number Edit Box( 42 ),

          Button Box( "OK", value = variablebox << get ),

  Button Box( "Cancel" )

);

Show( value );


View solution in original post

4 REPLIES 4
katief
Staff (Retired)

Get values from Modal New Window

I just noticed something interesting:

If I run the New Window as a block of code by itself and then run the variablebox<<get by itself, I get the scriptable object error. If I run the New Window code with the variablebox<<get command all at once, I get the correct value returned.

ms
Super User (Alumni) ms
Super User (Alumni)

Re: Get values from Modal New Window

As soon Ok or Cancel is clicked, the reference is forgotten, and hence the error. Put the get command, or any script, inside the Ok-button to ensure that it will run before the modal window is history.

New Window( "Set a Value",

          <<Modal,

  Text Box( "Set this Value" ),

          variablebox = Number Edit Box( 42 ),

          Button Box( "OK", value = variablebox << get ),

  Button Box( "Cancel" )

);

Show( value );


katief
Staff (Retired)

Get values from Modal New Window

Thank you for the help!

David_Burnham
Super User (Alumni)

Get values from Modal New Window

Just to be slightly pedantic about this - the reference is only lost once the script completes execution.  So the example you gave does work correctly, but only if you allow the entire script to execute (as opposed to running a partial block of code).  Therefore if you were to create a modal window without explicit button display boxes, it would still work e.g.

New Window("Set a Value",<<Modal,

     TextBox("Set this Value"),

     variablebox = Number Edit Box(42),

);

x = variablebox<<get;

show(x);

-Dave

-Dave