How can execute JSL commands after conditions is meetDear JMP community users,
I am a new for JMP and I have been facing a problem. Hopefully, I could get help from you guys.
I have a data table. I would like to run a graph builder for columns only some specific values.
For instance, I would like to select cells that are AB766 and RSDF belonging columns "monitor_set_name" and "measurement_set_name" ;and other columns and rows corresponding to " AB766" and "RSDF"

Then, I would like to run " Graph builder " for the table that contains information I need.
If "monitor_set_name" and "measurement_set_name" do not contain "AB766" and "RSDF", I will skip to run the "graph builder"
Could you give me some advice?
Sincerely,
Data TableScriptingRe: How can execute JSL commands after conditions is meetTo generate the JSL below, I simply ran the steps interactively, and then grabbed the code from the log and pasted it into a script window.
names default to here(1);
// Open Data Table: big class.jmp
// → Data Table( "big class" )
Open( "$SAMPLE_DATA/big class.jmp" );
// Select matching cells
Data Table( "big class" ) << Select Where( :age == 12 & :sex == "F" );
// Subset data table
// → Data Table( "Subset of big class" )
Data Table( "big class" ) << Subset( Selected Rows( 1 ), Selected columns only( 0 ) );
// Report snapshot: Subset of big class - Graph Builder
Data Table( "Subset of big class" ) << Graph Builder(
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);
// Invert current selection
Data Table( "big class" ) << Invert Row Selection;
// Subset data table
// → Data Table( "Subset of big class 2" )
Data Table( "big class" ) << Subset( Selected Rows( 1 ), Selected columns only( 0 ) );
// Report snapshot: Subset of big class 2 - Graph Builder
Data Table( "Subset of big class 2" ) <<
Graph Builder(
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 6 ) ), Smoother( X, Y, Legend( 7 ) ) )
);
Re: How can execute JSL commands after conditions is meetHi,
If you are new to JMP, be sure to check out the Local Data Filter and Column Switcher. The local data filter will likely help you here... I included a column switcher in my example just to let you know what it can do.
Just click on the menu items to restrict your graph to the data you wish to consider. No coding is required, and it is easy to use... anyone can use these.
To get the Local Data Filter, from Graph Builder's red triangle menu select Add Local Data Filter.
To get the Column Switcher, select Redo > Column Switcher from the main menu. You'll also have to select the column you want to swap out, and the columns you'd like to rotate among. Be sure to include the column you want to swap out, in this set. All columns must be of the same data type.
Run the script below to get a glimpse of these in action.
Cheers,
Brady

Names Default To Here(1);
dt = open ("$Sample_Data\Car Physical Data.jmp");
Graph Builder(
Size( 526, 448 ),
Show Control Panel( 0 ),
Variables( X( :Country ), Y( :Gas Tank Size ) ),
Elements( Box Plot( X, Y, Legend( 8 ) ), Points( X, Y, Legend( 9 ) ) ),
Local Data Filter(
Show Histograms and Bars( 0 ),
Add Filter(
columns( :Type ),
Where( :Type == "Compact" ),
Display( :Type, N Items( 5 ) )
)
),
Column Switcher(
:Gas Tank Size,
{:Weight, :Turning Circle, :Displacement, :Horsepower, :Gas Tank Size}
)
);
Re: How can execute JSL commands after conditions is meetDear txnelson,
It works. Appreciate a lot .
I try to follow your guidance and apply it for myself
dt = Open( "raw_data.csv", "invisible" );
dt << Select Where(
:monitor_set_name == "CSP_FAST_TC" & :spc_chart_subset == "STDDEV" & :measurement_set_name == "U1_X"
);
df = dt << Subset( Selected Rows( 1 ), Selected columns only( 0 ), "invisible" );
df << Graph Builder(
Size( 1056, 675 ),
Show Control Panel( 0 ),
Automatic Recalc( 0 ),
Variables(
X( :spc_txn_date ),
Y( :chart_value ),
Y( :lo_control_lmt, Position( 1 ) ),
Y( :up_control_lmt, Position( 1 ) ),
Y( :centerline, Position( 1 ) ),
Group Y( :monitor_set_name ),
Group Y( :measurement_set_name ),
Group Y( :spc_chart_subset ),
Wrap( :spc_entity )
),
Elements(
Line( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 25 ), Connection( "Curve" ), Smoothness( 0.5 ) )
),
SendToReport(
Dispatch( {}, "spc_txn_date", ScaleBox, {Label Row( Automatic Font Size( 0 ) )} ),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
25,
Properties( 2, {Line Color( 19 )} ),
Properties( 3, {Line Color( 0 ), Line Style( "Dotted" )} )
)}
)
)
);
df << save picture( "C:\Users\lamquocb\image.jpg" );
However, I encounter another issue that I could not save the picture - graph builder for df.
I try to access the location I want to store the picture, but I could not find one.
Do you have any advice?
Sincerely,
Re: How can execute JSL commands after conditions is meetYour variable "df" points to the subsetted data table. When you create a report from a data table, it does not become part of the data table. It is an entity upon itself. Therefore the easiest way to access the created report, is to specify a variable to point to it. I have done this in the below modification of your script.
gb = df << Graph Builder(
Variable "gb" points to the Graph Builder object. Later in the code, the Save Picture message is applied to the report generated by the Graph Builder platform
report(gb) << save picture( "C:\Users\lamquocb\image.jpg" );
Here is the modified script
names default to here( 1 );
dt = Open( "raw_data.csv", "invisible" );
dt << Select Where(
:monitor_set_name == "CSP_FAST_TC" & :spc_chart_subset == "STDDEV" & :measurement_set_name == "U1_X"
);
df = dt << Subset( Selected Rows( 1 ), Selected columns only( 0 ), "invisible" );
gb = df << Graph Builder(
Size( 1056, 675 ),
Show Control Panel( 0 ),
Automatic Recalc( 0 ),
Variables(
X( :spc_txn_date ),
Y( :chart_value ),
Y( :lo_control_lmt, Position( 1 ) ),
Y( :up_control_lmt, Position( 1 ) ),
Y( :centerline, Position( 1 ) ),
Group Y( :monitor_set_name ),
Group Y( :measurement_set_name ),
Group Y( :spc_chart_subset ),
Wrap( :spc_entity )
),
Elements(
Line( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Legend( 25 ), Connection( "Curve" ), Smoothness( 0.5 ) )
),
SendToReport(
Dispatch( {}, "spc_txn_date", ScaleBox, {Label Row( Automatic Font Size( 0 ) )} ),
Dispatch(
{},
"400",
ScaleBox,
{Legend Model(
25,
Properties( 2, {Line Color( 19 )} ),
Properties( 3, {Line Color( 0 ), Line Style( "Dotted" )} )
)}
)
)
);
report(gb) << save picture( "C:\Users\lamquocb\image.jpg" );
I strongly recommend that you take the time to read the Scripting Guide, available in the JMP Documentation Library, found under the Help pull down menu!