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
Fruit | Colors | Count (N) |
Apple | Green | 5 |
Tomato | Red | 2 |
Tomato | Green | 6 |
Apple | Red | 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.