Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Re: How to use '<< Select Where' or '<< Get Rows Where' on a list of columns nam...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Apr 29, 2015 6:43 AM
(7094 views)

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

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

3 REPLIES 3

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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