cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
rshehadah
Level I

Flag rows in a dataset

Hi,

 

I want to figure out a way that JMP flags rows in a dataset or qunatify the number of values that are less than or equal to 40.

 

It will be very cool if it can be a JSL script that can be used for an add in. 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Flag rows in a dataset

Oops.....that's what I get for not actually running the code.  The Select Rows Where() should have been

dt << get rows where( :Count <= 40 );

However, given that you also want the rows selected....I think the following script will work better

names default to here(1);

dt = Current Data Table();
dt << Select Rows Where( :Count <= 40 );
NumberOfRows = N Rows( dt << get selected rows );
New Window( "Message",
	modal,
	H List Box(
		Spacer Box( size( 5, 0 ) ),
		Text Box( Char( Length( NumberOfRows ) ) ),
		Text Box( " Columns Were Deleted" )
	)
);
Jim

View solution in original post

8 REPLIES 8
txnelson
Super User

Re: Flag rows in a dataset

I don't know what the Variable of question is, however the simple script to do this is:

NumberOfRows = N Rows( Select Rows Where( :Your Target Row <= 40) );
Jim
rshehadah
Level I

Re: Flag rows in a dataset

Thank you for the response.

 

I have this response variable in my data set which I want to flag if it has a value 40 or less.

 

The command you shared with me does highlight the rows that have a value of 40 or less, however is there a way that I can add the number of rows highlighted and have some caption box pop up with the number of rows highlighted?

rshehadah
Level I

Re: Flag rows in a dataset

Something like this:

 

NumberOfRows = N Rows( Select Rows Where( :Count <= 40) );

New Window( "Message", modal,
H List Box(
Spacer Box( size( 5, 0 ) ),
Text Box( Char( Length(NumberOfRows) ) ),
Text Box( " Columns Were Deleted" )
)
);

 

However, the pop up screen does not show

rshehadah
Level I

Re: Flag rows in a dataset

Also that code for some reason does not highlight any of the rows
txnelson
Super User

Re: Flag rows in a dataset

Oops.....that's what I get for not actually running the code.  The Select Rows Where() should have been

dt << get rows where( :Count <= 40 );

However, given that you also want the rows selected....I think the following script will work better

names default to here(1);

dt = Current Data Table();
dt << Select Rows Where( :Count <= 40 );
NumberOfRows = N Rows( dt << get selected rows );
New Window( "Message",
	modal,
	H List Box(
		Spacer Box( size( 5, 0 ) ),
		Text Box( Char( Length( NumberOfRows ) ) ),
		Text Box( " Columns Were Deleted" )
	)
);
Jim
rshehadah
Level I

Re: Flag rows in a dataset

Thank you for your reply.

But for some reason when I try to run your code I get this error:

argument should be character in access or evaluation of 'Length' , Bad Argument( 1 ), Length/*###*/(NumberOfRows)

In the following script, error marked by /*###*/
Names Default To Here( 1 );
dt = Current Data Table();
dt << Select Rows Where( :Count <= 40 );
NumberOfRows = N Rows( dt << get selected rows );
New Window( "Message",
modal,
H List Box(
Spacer Box( size( 5, 0 ) ),
Text Box( Char( Length/*###*/(NumberOfRows) ) ),
Text Box( " Columns Were Deleted" )
)
);
rshehadah
Level I

Re: Flag rows in a dataset

Got it to run, however it does not get the correct number of rows that have count <= 40
rshehadah
Level I

Re: Flag rows in a dataset

got it. in the code remove Rows from the Select Rows Where