cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Thomas1
Level V

How to avoid JMP Alert window in a JSL

 

Names Default To Here( 1 );

If( N Table() == 0, Open(), );

dt = Current Data Table();

//Create Lauch Window for prompting dialog
nw = New Window( <<Modal,
    V List Box(
        Lineup Box( N Col( 2 ), Spacing( 14 ), ),
        H List Box(
            Panel Box( "Select Columns", clb = Filter Col Selector( dt, all ) ),
            Panel Box( "Cast Selected Columns into Fit Model Roles",
                Lineup Box( N Col( 2 ),
                    Button Box( "Y, Response", clbY << Append( clb << Get Selected ) ),
                    clbY = Col List Box( "Numeric", MinItems( 1 ), nlines( 8 ) ), 

                    Button Box( "X, Two Samples",
                        clbXs << Append( clb << Get Selected )
                    ),
                    clbXs = Col List Box(
                        "Character",
                        MinItems( 1 ),
                        MaxItems( 1 ),
                        nlines( 1 )
                    ), 

                )
            ), 

            Panel Box( "Action",
                Button Box( "OK",
                    yVars = clby << Get Items( "Column Reference" );
                    eVars = clbXs << Get Items( "Column Reference" );
                ), 

                Button Box( "Cancel" ),
                Text Box(),
                Button Box( "Remove",
                    clbY << Remove Selected;
                    clbXs << Remove Selected;
                )
            ), 

        ),
        H List Box()
    )
);

If( nw["button"] == -1,
    Throw( "Cancelled!" )
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to avoid JMP Alert window in a JSL

Names Default To Here( 1 );
If( N Table() == 0,
	dt = Current Data Table();
	Clear Symbols( dt );
	Try( dt = Open() );
	If( Is Empty( dt ), throw());
);
Jim

View solution in original post

4 REPLIES 4
jthi
Super User

Re: How to avoid JMP Alert window in a JSL

Open will throw an error if Cancel is pressed and you can catch it with Try-catch.

Names Default To Here(1);

Try(
	dt = Open();
,
	show(exception_msg);
);

Do error handling in the catch part, example above will just print the message to log and lets script to continue running.

-Jarmo
Thomas1
Level V

Re: How to avoid JMP Alert window in a JSL

Thanks for your fast reply. What additional code must be added or changed after the open dialog is canceled (with no alert window) to stop the code from running the dialog window?

txnelson
Super User

Re: How to avoid JMP Alert window in a JSL

Names Default To Here( 1 );
If( N Table() == 0,
	dt = Current Data Table();
	Clear Symbols( dt );
	Try( dt = Open() );
	If( Is Empty( dt ), throw());
);
Jim
Thomas1
Level V

Re: How to avoid JMP Alert window in a JSL

Thanks, Jim. That was exactly what I was looking for.