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
ralphtedesco
Level II

JSL to select Yes on a prompt

Hello,

 

I am on JMP 16.1

 

I have a set of data with a range check attached to it with data that is outside of the range that we will always exclude.

 

Correcting the LIMS entry is not an option unfortunately.

 

If possible, how would one script it to always select Yes on the resulting prompt below for the range check?

 

ralphtedesco_0-1683295716957.png

 

Thank you for any help, every day you learn something new about this program.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: JSL to select Yes on a prompt

I see what you mean, and I am not sure how to suppress that warning message.  For this use case though I would just skip the Range Check function and do this instead:

 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

For each row( dt, 
	if(:Height < 53, :Height = Empty());
	if(:Height > 65, :Height = Empty());
);

View solution in original post

6 REPLIES 6
Byron_JMP
Staff

Re: JSL to select Yes on a prompt

this is an example from the scripting index

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
:Height << Range Check( LE LE( 48, 65) );
check = :Height << Get Range Check;
Show( check );

The values outside the range are set to missing, and there is no dialog.

JMP Systems Engineer, Health and Life Sciences (Pharma)
ralphtedesco
Level II

Re: JSL to select Yes on a prompt

Hello Byron,

 

Thanks for looking into it.

 

The Big Class source does not have any data outside of those ranges and wouldn't prompt the box. I tried following that prior to this and couldn't get it to work.

 

There are only 40 data points in that set and if you tighten the range check to exclude points then the prompt appears in the log of the Scripting Index.

 

Am I understanding it correctly?

ih
Super User (Alumni) ih
Super User (Alumni)

Re: JSL to select Yes on a prompt

At least for me the message is written to the log but the script does continue.  I am sure there is a more elegant solution to clean up your log, but the middle four lines here is a 'brute force' approach:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
log entry = Log Capture(:Height << Range Check( LE LE( 48, 62) ));
if(
	is missing(regex(log entry, "^(\!NOut of range.*Continue\!\?\!N$)|()")),
	throw("Unexpected problem in range check:\!N" || char( log entry ) )
);
check = :Height << Get Range Check;
Show( check );

To simulate an error (I don't know what might cause Range Check() to fail) you can replace the log entry line with this:

log entry = Log Capture( 1/"a" ) ; 

 

ralphtedesco
Level II

Re: JSL to select Yes on a prompt

Hello ih,

 

I am guessing part of the problem I am having is that I am trying to script it into a JSL Quote into a clickable button to pull the data from the LIMS. If I run your script outright then it works exactly as you described. But if I put it into a button then it stops working.

 

Specifically it gives the throw response of "Unexpected problem in range check:" but there is no information after the colon to tell me what it is getting stuck trying to do in the range check. If I substitute the log entry line like you said then it does give me something to work with "Cannot convert argument to a number [or matrix] in access or evaluation of 'Divide' , 1 / /*###*/"a" /*###*/" When in the button it is also giving the same dialog box as I had described in the original post.

 

It sounds as though this just might be more of an effort than it is worth to try and script away.

 

JSL is the first language I am learning so there is still so so much to learn about it. Something tells me this is something small and fundamental that I do not understand yet.

ih
Super User (Alumni) ih
Super User (Alumni)

Re: JSL to select Yes on a prompt

I see what you mean, and I am not sure how to suppress that warning message.  For this use case though I would just skip the Range Check function and do this instead:

 

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

For each row( dt, 
	if(:Height < 53, :Height = Empty());
	if(:Height > 65, :Height = Empty());
);
ralphtedesco
Level II

Re: JSL to select Yes on a prompt

Thanks ih!

 

I've tried it and that does exactly what I am looking for.

 

Thank you for your help, this has quite a few applications so far and I am wondering where else I can apply this logic.