Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
spudton
Level III

Application Newbie - run script from Number Edit Box

I have this piece of script which allows a user to input a number to fill a column. It will ultimately be used to format the data being charted.

When I create a number edit box in application builder , it's not obvious to me what the script should be within the Number edit box Properties (if indeed, that is where i enter the script)

I assume i lose the top 8 lines, as the creation of the box is already done, but the bottom 3 lines don't work for me.

thanks in advance.

win = New Window( "Set a Value",
	<<Modal,
	<<Return Result,
	Text Box( "Set this value" ),
	variablebox = Number Edit Box( 42 ),
	Button Box( "OK" ),
	Button Box( "Cancel" )
);

dt = Current Data Table();
a = win["variablebox"];
:P1F012 ETLag << Set Each Value( (a) );
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
pmroz
Super User

Re: Application Newbie - run script from Number Edit Box

In Application Builder right-click on your number edit box and select Scripts > Script:

definescript.png

This will create the following script in the Scripts tab:

variable_nebScript=Function({this},{numEditValue},
	// This function is called when the number edit value is committed
	numEditValue = this << Get;
);

This script is also referenced in the properties panel (rhs of screen)

variable_neb.png

 

Note - there are two kinds of behaviors you can write functions for:

Script: runs after the user changes focus from the number edit box.

Number Changed: runs after every character is entered.

View solution in original post

3 REPLIES 3
Highlighted
txnelson
Super User

Re: Application Newbie - run script from Number Edit Box

Your code works fine for me......as long as the current data table has a column called "P1F012 ETLag"

 

I added just a couple of items, that should not have any impact on the code, if the Current Data Table is actually the table you have last activated and it has the column "P1F012 ETLag"

win = New Window( "Set a Value",
	<<Modal,
	<<Return Result,
	Text Box( "Set this value" ),
	variablebox = Number Edit Box( 42 ),
	Button Box( "OK" ),
	Button Box( "Cancel", throw() )
);

dt = Current Data Table();
a = win["variablebox"];
dt:P1F012 ETLag << Set Each Value( (a) );
Jim
Highlighted
spudton
Level III

Re: Application Newbie - run script from Number Edit Box

Thaks Jim,

to be clear, that whole code worked fine for me when run from the data table, I'm just struggling on what the code should be, and where i write it, in application builder, to customise a number edit box that I've added graphically.

thanks again.

Highlighted
pmroz
Super User

Re: Application Newbie - run script from Number Edit Box

In Application Builder right-click on your number edit box and select Scripts > Script:

definescript.png

This will create the following script in the Scripts tab:

variable_nebScript=Function({this},{numEditValue},
	// This function is called when the number edit value is committed
	numEditValue = this << Get;
);

This script is also referenced in the properties panel (rhs of screen)

variable_neb.png

 

Note - there are two kinds of behaviors you can write functions for:

Script: runs after the user changes focus from the number edit box.

Number Changed: runs after every character is entered.

View solution in original post

Article Labels