In this guide, you can learn about advanced filtering options.
Conditional and selection filters can be combined only programmatically, not via UI.
To combine the filters, follow the steps below:
Step 1. Specify the conditional filter for the necessary field using the filter.query.
Step 2. For the same field, specify the selection filter using one of the following properties:
Step 3. Preset the filter combination in the report or apply it using the setFilter() API call to see the result:
rows: [ { uniqueName: "Country", filter: { query: { // Include countries with "United" in their name contain: "United" }, // Include countries listed below include: [ "Country.[France]", "Country.[Germany]", ] }, }, ],
const combinedFilter = {
query: {
// Include countries with "United" in their name
contain: "United"
},
// Include countries listed below
include: [
"Country.[France]",
"Country.[Germany]",
]
};
pivot.setFilter("Country", combinedFilter);
Note If there is a filter combination in the slice, we recommend disabling the filter view since it does not support filter combinations. The filter view can be disabled:
By default, if the selection filter contains only members that do not exist in the dataset, Flexmonster ignores it and displays all field members. If you want to change this behavior so that an empty grid is shown instead, follow the steps described in this section.
Note If you are using the "json"
or "csv"
data source type and Flexmonster version 2.9.86 or later, you can change the behavior by setting the filter.allowEmptyMembersFilter option to true
.
Step 1. Specify the required field members in the filter.include property. Here is an example:
rows: [ { uniqueName: "Category", filter:{ // Selection filter // Members that might not exist in the report include: ["Computers", "Phones"] }, }, ],
Step 2. For the same field, specify the filter.query property that always returns an empty result. In the example below, the equal: ""
query returns an empty result because there are no blank field members in our dataset:
rows: [ { uniqueName: "Category", filter:{ // Selection filter // Members that might not exist in the report include: ["Computers", "Phones"], // Conditional filter // The query always returns an empty result query: { equal: "" } }, }, ],
Now the filter.query
will cover the cases when the filter.include
is ignored. Since the filter.query
always returns an empty result, an empty grid will be shown if you specify non-existent members in the filter.include
Live example.
Learn more about combining the conditional and selection filters.
The search in the filter pop-up window can be used to select or deselect multiple members at once.
Use the search depending on how you want to modify the selection filter:
Step 1. Open the filter pop-up window.
Step 2. optional To clear the current selection, click Select all until all members are deselected.
Step 3. In the search box, enter a search term to find the members you want to include. For example, to include Poland
and Switzerland
in the selection, enter land
in the search box.
Step 4. Click Select all results until all members that match the search term are selected. If there are members you want to exclude, deselect them individually.
Step 5. optional To include more members, click × in the search box and return to Step 2.
Step 6. Click Apply to see the result.
Step 1. Open the filter pop-up window.
Step 2. optional To clear the current selection, click Select all until all members are selected.
Step 3. In the search box, enter a search term to find the members you want to exclude. For example, to exclude Poland
and Switzerland
from the selection, enter land
in the search box.
Step 4. Click Select all results until all members that match the search term are deselected. If there are members you want to include, select them individually.
Step 5. optional To exclude more members, click × in the search box and return to Step 2.
Step 6. Click Apply to see the result.