One can restrict an existing data filter further with the command:
df << (Filter Column(:age) << Where(::age == 14));To add a new data filter group (standard setting: filter1 OR filter2)
one can use:
df << Add Filter(Columns(:age), Where(::age == 14));I just noticed that if the data filter is set to "conditional", it is not possible to add a new filter group.
You can still use the code, but the action is exactly like in the first case: new filter is included in the first filter.
This means that it is not possible to define 2 distinct filter groups with conditional behavior.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
Graph Spacing( 5 ),
Variables,
Elements( Points( Legend( 2 ) ) ),
);
df = gb << Local Data Filter(
Add Filter( columns( :sex, :name ),Where(:sex="M"),Display( :name, N Items( 6 ))),
Add Filter( columns( :sex, :age, :name ),Where(:sex="F"), Display( :name, N Items( 6 )))
);
wait(5);
// 2 separate data filters --> OR
gb <<Remove Local Data Filter;
wait(1);
df = gb << Local Data Filter(
Conditional,
Add Filter( columns( :sex, :name ),Where(:sex="M"),Display( :name, N Items( 6 ))),
Add Filter( columns( :sex, :age, :name ),Where(:sex="F"), Display( :name, N Items( 6 )))
);
// 2nd data filter is included in the first one
The "Conditional" option lets you make a series filter selections, where the options available in subseuquent steps are dependent on prior selections.
For example: If I have columns, State, County, City, Street. If conditional is turned on, and I select North Carolina from the state, only Counties, Cities and Streets in N. Carolina would appear as levels in the other selections boxes. Next, if I selected "Wake" from the county list of levels, only cities and streets in Wake County would appear.
Alternatively, I could make my first selection in the Street box. If I chose "West", only cities, counties and states that have a "west" street would show up as options in the other boxes.
The order of the conditional selection is based on the order of the column that is selected, not the order of the columns in the dialog. (super convenient).
Thanks for the clarification how the "conditional" option works for Data Filters :)
I still need some further input to understand why it's not possible to add a second data filter group to the data filter if "conditional" is enabled.
For the second example above, I expected to get two data filter groups, one for male (with just male names) and one for female (with just female names) -
actually like it's the case when "conditional" is not activated, just with the feature that the male/female selection restricts the list of names.
I mean: conditional should just activate the conditional displaying of list entries - it should not change the logics behind the data filter structure.
It's surprising that the result for the second example with "conditional" activated is so different:
what I expected:
what I got:
Hi @hogi - I think it would be worth adding items to the Wish List to gauge interest in more flexible use of the conditional flag. I'm not certain, but it seems like the current limitations are primarily based on whether any 'OR' conditions are in use. Both Multiple Response and the Text Filter have options for selecting matches that behave more like 'OR' filters, and neither of them support conditional.
-Dan
could you give an example for the "text filter"?