cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • See how to interactively organize and restructure data for analysis. Register for May 29 webinar, 2pm US ET.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
asiegel
Level I

Filtering Rows by List

JMP 18

 

I am attempting to subset a table based on values selected from combo boxes. I have two sets of combo boxes that interplay, which I have called cb1 and cb2, for the parent combo boxes, and subCB1 and subCB2, for "Sub" combo boxes. The parent combo boxes cb1 and cb2 make up the columns of a data table, dt_SUM, and the data under each column then populates the options it's corresponding sub combo box, subCB1 or subCB2 respectively.

 

The combo box selections and the dt_SUM data table would look something like this:

 

cb1: Fruit                subCB1: Apple

cb2: Colors             subCB2: Red

 

dt_SUM

FruitColorsCount (N)
AppleGreen5
TomatoRed2
TomatoGreen6
AppleRed

8

 

I am trying to subset the dt_SUM table based on the selections of the combo boxes and subcombo boxes. For instance, I want the new table, dt_COUNT to display only the row that corresponds to Apple and Red. I have attempted to do so a few ways, but primarily through trying to propagate a list that contains the expression for filtering the cb1 column by the subCB1 selection. 

selectedConditions = List();

If(cb1 != "Select Parameter", Insert Into( selectedConditions, Expr(Column(dt_SUM, cb1) == subCB1 ) ) );

If(cb2 != "Select Parameter", Insert Into( selectedConditions, Expr(Column(dt_SUM, cb2) == subCB2 ) ) );

SOPmean;

SOPMean = Expr(
	dt_MEAN = dt_SUM << Subset(
		Filtered rows( selectedConditions ),
		Selected columns only( 0 ),
		columns( :Count ),
		output table name ( "count")
	)
);

The cb1 != "Select Parameter" covers that there are up to 5 combo boxes and default set to "Select Parameter" so if unchanged do not want them involved.
I've tried various versions of adding Char( and << Get selected within the expression but havent yet been able to print {:Fruit == "Apple", :Color == "Red"} successfully. Thanks for any help.

2 REPLIES 2
asiegel
Level I

Re: Filtering Rows by List

For additional clarification, the final table I am hoping to look like

FruitColorCount
AppleRed8
jthi
Super User

Re: Filtering Rows by List

Can you provide the script you have written up to this point?

-Jarmo

Recommended Articles