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
nkelleh
Level III

How to use '<< Select Where' or '<< Get Rows Where' on a list of columns names or references?

Hi,

Basically, I have script where I'm trying to return the row numbers of certain columns that contain a specific value. In my example, I have several columns where the value can either be a 1 or a 0. I'm trying to get the row numbers for any row that contains a zero regardless of which column its in. I can do this easily enough for one column using the following syntax:


selectedRows = datatable << Get Rows Where( As Column(colNameStr) == 0 );


However, when I want to do this for a number of columns, say in a list of column names or references, I'm stumped. I feel like this should be catered for, but I can't figure out if its possible or what the correct syntax is. For example


selectedRows = datatable << Get Rows Where( FOR EACH COLUMN IN LIST == 0 );


Any help on this matter would be greatly appreciated. The reason why I want it to work with a list is that I want it to work for any number of columns or column names. I'm using JMP11.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
vince_faller
Super User (Alumni)

Re: How to use '<< Select Where' or '<< Get Rows Where' on a list of columns names or references?

list = {:A, :B, :C};

dt << Select Where(ANY(list));

This only works as is because you have boolean values in your columns. 

Vince Faller - Predictum

View solution in original post

3 REPLIES 3
vince_faller
Super User (Alumni)

Re: How to use '<< Select Where' or '<< Get Rows Where' on a list of columns names or references?

list = {:A, :B, :C};

dt << Select Where(ANY(list));

This only works as is because you have boolean values in your columns. 

Vince Faller - Predictum
nkelleh
Level III

Re: How to use '<< Select Where' or '<< Get Rows Where' on a list of columns names or references?

Thanks very much! I knew there was some way to do it. Out of curiosity, is there any way to do it for non-boolean values?

Thanks again!

vince_faller
Super User (Alumni)

Re: How to use '<< Select Where' or '<< Get Rows Where' on a list of columns names or references?

With the list?  Can't think of anything off hand.  

You could do

ANY(:A == "donkey", :B <=14, :C), C being a boolean still

Vince Faller - Predictum