How to use get selected values from a combo box inside another expression on a different jsl script?Hello All,
I have 2 scripts. ScriptA has an expression to build a bivariate chart with dynamic limits. ScriptB is basically an front end application code which asks users to select the x-axis and y-axis column names. I want to use the selected inputs from the users from ScriptB (i.e. get selected from a combo box) into my ScriptA expression code for getting the bivariate chart as an output for the selected columns.
MY AIM IS TO GET THE GRAPH WITH SLIDERS FOR THE SELECTED PARAMETERS WHEN I RUN SCRIPT B !!
/////////////////////////////////SCRIPT B///////////////////////////////////////////////////
include("ScriptA");
myStaticLibContainer = vListBox(); //Making a static container
//////Calling the expression "myFinalDisplay" from ScriptA and adding it to the static container//////
sliderGraph = buttonBox("Get Slider Graph", myStaticLibContainer << append(vListBox(myFinalDisplay)));
///Creating user input boxes///
inputParameter = comboBox("Parameter");
response = comboBox("Response");
blocking = comboBox("FAB");
myMainToolPanelBox = panelBox("myMainToolPanelBox",
vListBox(
spacerBox(size(1000,0)),
V List Box(Text Box("Predictor"), inputParameter),
V List Box(Text Box("Response"), response),
V List Box(Text Box("Block By"), blocking)),
H List Box(sliderGraph),
scrollBox(size(1000,550), myStaticLibContainer),
);
myPlatform = newWindow("Loss Curves", myMainToolPanelBox);
/////////////////////////////////SCRIPT B ENDS///////////////////////////////////////////////////
////////////////////////////////////SCRIPT A//////////////////////////////////////
DT = open("data.jmp", invisible);
//Getting the inputs
x = inputParameter << get Selected;
y = response << get Selected;
z = blocking << get Selected;
//Making graphs
myFinalDisplay = expr(
myGbDispObj = dt << Bivariate(
Size( 550, 400 ),
Y( Eval(y) ),
X( Eval(x) ),
Automatic Recalc( 1 ),
Histogram Borders( 1 ),
Summary Statistics( 1 ),
Fit Spline( 2, {Line Color( {212, 73, 88} )} ),
SendToReport(
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Row Legend(
Eval(z),
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 1 ),
Marker Theme( "Solid" ),
Continuous Scale( 1 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
),
Dispatch( {}, "Summary Statistics", OutlineBox, {Close( 1 )} )
)
);
myLimitCol = column(DT, Eval(x));
myLimitMin = colMinimum(myLimitCol); show(myLimitMin);
myLimitMax = colMaximum(myLimitCol); show(myLimitMax);
myTbLo = textBox(Char(round(myLimitMin, 2)) || " (OOC = " || char(0.00, 10, 2) || "%)");
myTbHi = textBox(Char(round(myLimitMax, 2)) || " (OOC = " || char(0.00, 10, 2) || "%)");
mySbDispObj = rangeSliderBox(
myLimitMin,
myLimitMax,
32,
36,
//script
mySelectedLower = mySbDispObj << getLower;
mySelectedUpper = mySbDispObj << getUpper;
myGbDispObj << Dispatch( {}, "1", ScaleBox, {Add Ref Line( mySelectedLower, "Dashed", "blue", "LCL", 4 )} );
myGbDispObj << Dispatch( {}, "1", ScaleBox, {Add Ref Line( mySelectedUpper, "Dashed", "blue", "UCL", 4 )} );
rUpper = dt << Get Rows Where( myLimitCol[] > mySelectedUpper );
OOC_valUpper = (N Items(rUpper) / N rows(dt))*100;
myTbHi << setText(Char(round(mySelectedUpper, 1)) || " (OOC = " || char(OOC_valUpper, 10, 2) || "%)");
rLower = dt << Get Rows Where( myLimitCol[] < mySelectedLower );
OOC_valLower = (N Items(rLower) / N rows(dt))*100;
myTbLo << setText(Char(round(mySelectedLower, 1)) || " (OOC = " || char(OOC_valLower, 10, 2) || "%)");
);
mySbDispObj << Set Width( 275 );
myLayout = vListBox(
myGbDispObj,
hListBox(myTbLo, spacerBox(size(50,0)), myTbHi),
mySbDispObj
);
);
//PLATFORM = newWindow("TEST", vListBox(myFinalDisplay));
////////////////////////////////////SCRIPT A ENDS//////////////////////////////////////
/////////////////////////////////////////SCRIPT A ENDS///////////////////////////////////////
I have also attached the data table and scripts !!
Thank you in advance.
@txnelson
pmroz
Data TableGraphicsRe: How to use get selected values from a combo box inside another expression on a different jsl script?I made some modifications to your Script A. Basically, the changes were to ensure that variables that are being called have been defined prior to the calling of them. I added the Clear Symbols(); which helps with making sure the variables are not hanging around.
Clear Symbols();
DT = open("data.jmp", invisible);
//Making graphs
myFinalDisplay = Expr(
//Getting the inputs
x = inputParameter << get Selected;
y = response << get Selected;
z = blocking << get Selected;
myGbDispObj = dt << Bivariate(
Size( 550, 400 ),
Y( Eval( y ) ),
X( Eval( x ) ),
Automatic Recalc( 1 ),
Histogram Borders( 1 ),
Summary Statistics( 1 ),
Fit Spline( 2, {Line Color( {212, 73, 88} )} ),
SendToReport(
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Row Legend(
Eval( z ),
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 1 ),
Marker Theme( "Solid" ),
Continuous Scale( 1 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
),
Dispatch( {}, "Summary Statistics", OutlineBox, {Close( 1 )} )
)
);
myLimitCol = Column( DT, Eval( x ) );
myLimitMin = Col Minimum( myLimitCol );
Show( myLimitMin );
myLimitMax = Col Maximum( myLimitCol );
Show( myLimitMax );
myTbLo = Text Box( Char( Round( myLimitMin, 2 ) ) || " (OOC = " || Char( 0.00, 10, 2 ) || "%)" );
myTbHi = Text Box( Char( Round( myLimitMax, 2 ) ) || " (OOC = " || Char( 0.00, 10, 2 ) || "%)" );
mySbDispObj = Range Slider Box(
myLimitMin,
myLimitMax,
mySelectedLower,
mySelectedUpper,
//script
//mySelectedLower = mySbDispObj << getLower;
//mySelectedUpper = mySbDispObj << getUpper;
myGbDispObj << Dispatch( {}, "1", ScaleBox, {Add Ref Line( mySelectedLower, "Dashed", "blue", "LCL", 4 )} );
myGbDispObj << Dispatch( {}, "1", ScaleBox, {Add Ref Line( mySelectedUpper, "Dashed", "blue", "UCL", 4 )} );
rUpper = dt << Get Rows Where( myLimitCol[] > mySelectedUpper );
OOC_valUpper = (N Items( rUpper ) / N Rows( dt )) * 100;
myTbHi << setText( Char( Round( mySelectedUpper, 1 ) ) || " (OOC = " || Char( OOC_valUpper, 10, 2 ) || "%)" );
rLower = dt << Get Rows Where( myLimitCol[] < mySelectedLower );
OOC_valLower = (N Items( rLower ) / N Rows( dt )) * 100;
myTbLo << setText( Char( Round( mySelectedLower, 1 ) ) || " (OOC = " || Char( OOC_valLower, 10, 2 ) || "%)" );
);
mySbDispObj << Set Width( 275 );
myLayout = V List Box( myGbDispObj, H List Box( myTbLo, Spacer Box( size( 50, 0 ) ), myTbHi ), mySbDispObj );
);
//PLATFORM = newWindow("TEST", vListBox(myFinalDisplay));
The only change to Script B was to add scoping clarification to the "response" variable. You are using it in the script and it is also a column name. JMP was getting confused. So by adding "::" in front of it, it forced JMP to look for a memory variable, not a column for it's usage
myStaticLibContainer = vListBox(); //Making a static container
//////Calling the expression "myFinalDisplay" from ScriptA and adding it to the static container//////
sliderGraph = buttonBox("Get Slider Graph", myStaticLibContainer << append(vListBox(myFinalDisplay)));
///Creating user input boxes///
inputParameter = comboBox("Parameter");
::response = comboBox("Response");
blocking = comboBox("FAB");
myMainToolPanelBox = panelBox("myMainToolPanelBox",
vListBox(
spacerBox(size(1000,0)),
V List Box(Text Box("Predictor"), inputParameter),
V List Box(Text Box("Response"), response),
V List Box(Text Box("Block By"), blocking)),
H List Box(sliderGraph),
scrollBox(size(1000,550), myStaticLibContainer),
);
myPlatform = newWindow("Loss Curves", myMainToolPanelBox);
Re: How to use get selected values from a combo box inside another expression on a different jsl script?Thank you. This worked. The variables were getting overlapped.