cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

Beginner JSL query

AnovaPorpoise
Level I

I want to save selected rows from a table in a jmp file and also the inversion of the selected rows in another jmp file after using the partition function. I went through some examples and other threads but I am not able to save the selected rows and the inverted rows. I must be doing something wrong. Does anyone have any idea how it can be done in JSL?

 

Names Default To Here( 1 );
dt = Open( "C:/Users/Desktop/driver/MASTER.jmp" );
f = Function({a}, theRows = Current Data Table() << get selected rows;
Show(theRows);

);
obj = Partition(

       Y( :Failed ),

       X(
             :VOLUME,

             :FAMILY,

             :CONFIG

       ),

       Method( "Decision Tree" ),

       Validation Portion( .2 )

);

obj << ShowGraph( 0 );

obj << SplitBest( 4 );
 
obj << on close( Clear Symbols( rs ) );

 

action = 0;

actionsubset = 0;

 

look_window = New Window( "Decision",

       Lineup Box( N Col( 1 ),

             V List Box(

                    Text Box( "After selection of the rows,go for Plot?" ),

                    H List Box(

                          spacer box(size(100,5)),

                          Button Box( "Continue",

                                 action = 1;

                                 look_window << close window;

                                 //obj << Save( "C:\Users\Desktop\test.csv" );

                                 //filepath = "C:\Users\Desktop\driver";

                                 //rs << save( filepath || "\" || "p1.jmp" );

                                

                                 Include("C:/Users/Desktop/driver/plot.jsl");

                                

                          ),

                          Button Box( "Close",

                                 action = 2;

                                 Close( obj, nosave );

                         

                                 //Throw( "You cancelled the script." );

                          ),

                    )

             ),

 

       )

);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Beginner JSL query

The first item I can see, is that you are setting the variable "obj" to be a pointer to the output report for the Partition platform, and then in the New Window, you are using "obj" as if it is a pointer to your data table.  The pointer to your data table is the variable "dt" created when you opened the table.

Below is a simple example that shows a simple way to create a data table from selected rows, and then to create another data table from the inverse of that selection

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

dt << select where( :sex == "F" );

dtF = dt << subset( selected rows( 1 ), selected columns( 0 ) );

dt << invert row selection;

dtM = dt << subset( selected rows( 1 ), selected columns( 0 ) );

close( dt, nosave );
Jim

View solution in original post

1 REPLY 1
txnelson
Super User

Re: Beginner JSL query

The first item I can see, is that you are setting the variable "obj" to be a pointer to the output report for the Partition platform, and then in the New Window, you are using "obj" as if it is a pointer to your data table.  The pointer to your data table is the variable "dt" created when you opened the table.

Below is a simple example that shows a simple way to create a data table from selected rows, and then to create another data table from the inverse of that selection

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

dt << select where( :sex == "F" );

dtF = dt << subset( selected rows( 1 ), selected columns( 0 ) );

dt << invert row selection;

dtM = dt << subset( selected rows( 1 ), selected columns( 0 ) );

close( dt, nosave );
Jim