Subscribe Bookmark RSS Feed

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

nkelleh

Community Trekker

Joined:

Dec 19, 2012

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
Solution

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

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

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

3 REPLIES
Solution

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

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

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

nkelleh

Community Trekker

Joined:

Dec 19, 2012

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

Joined:

Mar 17, 2015

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

You could do

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