JSL : Define variables based on user entry through a pop up windowHello,
I would like to create a pop up window that allows the user to define variables without accessing the code. I managed to get the pop up to get the user entries based on previous posts, but wasn't able to pass it to the variables.
Could you please help me with this?
Thank you in advance
// Indicate here the name of the input HTML table
input_table = "http://xxx.html";
// Indicate here the name you want for your JMP data table
JMP_table_name = "JMP data table";
w = New Window( "User inputs", // opens a window with a title and this content...
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H Center Box( Text Box( "Report Generator" ) ), // a second title, centered
Spacer Box( size( 1, 30 ) ), // a little vertical space
H List Box( Text Box( "input_table: " ), input_table=Text Edit Box("http://xxx.html") ), // data entry
Spacer Box( size( 1, 30 ) ), // a little vertical space
H List Box( Text Box( "JMP_table_name: " ), JMP_table_name=Text Edit Box("JMP data table") ), // more data entry
Spacer Box( size( 1, 30 ) ), // a little vertical space
H Center Box( // center the button
Button Box( "Submit", // this script runs when the button is pressed...
input_table = result["input_table"];
JMP_table_name = result["JMP_table_name"];
w << closeWindow; // close the dialog
)
)
)
)
);ScriptingRe: JSL : Define variables based on user entry through a pop up windowThere are a couple of issues with your script. The first one, ir that you are changing the data type of the Input_table and the JMP_table_name variables. You start out with then defined as character strings, but then redefine them as Display fields.
Secondly, just because JMP is opening a window, does not stop the JSL processing, and wait for the user input. JMP will just continue to process, unless the window is defined as a Modal window See my modification of your script below. I strongly suggest that you take the time to take the time to read the Scripting Guide.
// Indicate here the name of the input HTML table
input_table = "http://xxx.html";
// Indicate here the name you want for your JMP data table
JMP_table_name = "JMP data table";
w = New Window( "User inputs", <<MODAL></MODAL>
Re: JSL : Define variables based on user entry through a pop up windowThank you so much!
Thanks also for explaining the mistakes I made; this will definitely help me through it in the future.
Have a good day!
Re: JSL : Define variables based on user entry through a pop up windowHello,
I jumped into an additional issue.
I managed to get the modal window opening and passed the new variables definitions within the script for the input_table and the JMP_table name.
Going on the variable I see that it was correctly updated.
Then, the rest of my script is supposed to perform actions, such as opening the table specified by the user (outside of the button), but it does not run.
I tried putting the whole script into the modal window, I tried also adding a wait() but this does not help.
If I run the script without the modal window it works fine, so the issue definitely comes from there.
Any idea how to solve this?
Here is the code.
// Initialize variables with default values
// Number of input data tables (default = 1)
nb_join_tables = 2;
//links to the input HTML tables
input_table_01 = "http://xxx.html";
input_table_02 = "http://xxx.html";
//Create a pop up window to request user inputs for the variables
w = New Window( "User inputs", <<MODAL></MODAL>
Re: JSL : Define variables based on user entry through a pop up windowI found the solution. I used a "Text Edit Box" and a "Get Text" for a numeric value. I modified to "Number Edit Box" and To "Get" and it works. :
// Initialize variables with default values
// Number of input data tables (default = 1)
nb_join_tables = 2;
//links to the input HTML tables
input_table_01 = "http://xxx.html";
input_table_02 = "http://xxx.html";
//Create a pop up window to request user inputs for the variables
w = New Window( "User inputs", <<MODAL></MODAL>