cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Agustin
Level IV

How to pass data from Select Where to array

Hi, I'm trying to adapt this solution: https://community.jmp.com/t5/Discussions/Create-a-associative-array-from-unique-selected-rows-and-ro...

using Select Where instead of Select Rows.

dt1 << Select Where( :Test == "Fail" );

I would like to create an array of the columns Age and Class for all the selected rows. Selected Rows doesn't seem to work and the Script Index Guide isn't clear on what object Select Where returns.

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: How to pass data from Select Where to array

maybe something like this

dt = Open( "$sample_data/big class.jmp" );
rows = dt << getrowswhere( 13 <= age <= 15 );
matrix = dt[rows, {height, weight}];

I don't think <<SelectWhere returns a value; it makes rows in the table selected. Other messages, like <<deleteRows, can operate on the current selection.

Craige

View solution in original post

4 REPLIES 4
jthi
Super User

Re: How to pass data from Select Where to array

Could you provide clear example about what you want to do? The linked topic doesn't seem to have Test, Age or Class mentioned anywhere. You want to select rows based on something and then get values based on that selection on some columns?

-Jarmo
Agustin
Level IV

Re: How to pass data from Select Where to array

Yes, so when I use:

dt1 << Select Where( :Test == "Fail" );

In the data table these rows appear as selected (highlighted in blue), the data table has columns Age and Class so I would like to create an array in pairs for all the selected rows. 

Then I want to use the array in pairs to hide and exclude all rows where Age and Class are equal to one of the pairs.

e.g. if one of the rows where Test = Fail has Age = 14 and Class = 2, I would want to store the values ( (14,2), ... , ) in an array and then all rows where Age = 14 and Class = 2  I want to hide and exclude.

 

 

Craige_Hales
Super User

Re: How to pass data from Select Where to array

maybe something like this

dt = Open( "$sample_data/big class.jmp" );
rows = dt << getrowswhere( 13 <= age <= 15 );
matrix = dt[rows, {height, weight}];

I don't think <<SelectWhere returns a value; it makes rows in the table selected. Other messages, like <<deleteRows, can operate on the current selection.

Craige
Agustin
Level IV

Re: How to pass data from Select Where to array

Thank you that works. I find the documentation quite difficult to navigate.