We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.
All documentation
  • Introduction
  • Connecting to data source
  • Browser compatibility
  • Documentation for older versions
  • Filter by condition

    In Flexmonster, you can filter field members based on a certain condition. For example, you can create a filter to display dates of the previous quarter or countries that contain "Republic" in their name.

    About the filter

    The filter by condition exists for the following field types:

    • Number
      Note that in the flat form, the value filter is applied to number fields instead of the conditional filter.
    • String
    • Date
    • Time

    Each field type supports different filtering conditions. The filter’s availability for data sources also depends on the field type.

    Availability for data sources

    Filter for number fieldsFilter for string fieldsFilter for date fieldsFilter for time fields
    JSON
    CSV
    Flexmonster Data Server
    MongoDB
    Microsoft Analysis Services
    Custom data source API***
    Elasticsearch

    * For the custom data source API, the filter by condition must be implemented on your server. For more details, refer to the Implementing filters guide.

    Available conditions

    The following filtering conditions are available for each data type:

    Number

    • Equal – Shows numbers equal to the specified number.
    • Not equal – Shows numbers not equal to the specified number.
    • Greater – Shows numbers greater than the specified number.
    • Greater or equal – Shows numbers greater than or equal to the specified number.
    • Less – Shows numbers less than the specified number.
    • Less or equal – Shows numbers less than or equal to the specified number.
    • Between – Shows numbers between the specified numbers (including them).
    • Not between – Shows numbers not between the specified numbers (excluding them).

    String

    • Equal – Shows strings equal to the specified string.
    • Not equal – Shows strings not equal to the specified string.
    • Begin – Shows strings that begin with the specified string.
    • Not begin – Shows strings that do not begin with the specified string.
    • End – Shows strings that end with the specified string.
    • Not end – Shows strings that do not end with the specified string.
    • Contain – Shows strings that contain the specified string.
    • Not contain – Shows strings that do not contain the specified string.
    • Greater – Shows strings greater than the specified string.
    • Greater or equal – Shows strings greater than or equal to the specified string.
    • Less – Shows strings less than the specified string.
    • Less or equal – Shows strings less than or equal to the specified string.
    • Between – Shows strings between the specified strings (including them).
    • Not between – Shows strings not between the specified strings (excluding them).

    Date

    • Equal – Shows dates equal to the specified date.
    • Not equal – Shows dates not equal to the specified date.
    • Before – Shows dates before the specified date.
    • Before or equal – Shows dates before or equal to the specified date.
    • After – Shows dates after the specified date.
    • After or equal – Shows dates after or equal to the specified date.
    • Between – Shows dates between the specified dates (including them).
    • Not between – Shows dates not between the specified dates (excluding them).
    • Last… – Shows dates of a previous period. The period can be one of the following values: Day, Week, Month, Quarter, Year
    • Current… – Shows dates of a current period. The period can be one of the following values: Day, Week, Month, Quarter, Year
    • Next… – Shows dates of a next period. The period can be one of the following values: Day, Week, Month, Quarter, Year

    Note Filter by condition does not work for fields of the "date" type. You can still apply selection and value filters to fields of this type.

    Time

    • Equal – Shows time periods equal to the specified time period.
    • Not equal – Shows time periods not equal to the specified time period.
    • Greater – Shows time periods greater than the specified time period.
    • Greater or equal – Shows time periods greater than or equal to the specified time period.
    • Less – Shows time periods less than the specified time period.
    • Less or equal – Shows time periods less than or equal to the specified time period.
    • Between – Shows time periods between the specified time periods (including them).
    • Not between – Shows time periods not between the specified time periods (excluding them).

    Applying the filter

    The filter by condition can be:

    • Applied via UI
    • Preset in the report
    • Applied using API calls

    Via UI

    Step 1. Open the filter view by clicking the field’s name or using the field’s context menu. You can resize the filter view using its window borders.

    Step 2. Depending on the field’s type, select an option to filter by:

    • Labels – for string and number fields.
    • Dates – for date fields.
    • Time – for time fields.

    This will open a subview where you can specify the filter by condition.

    Step 3. In the subview, choose a condition from the dropdown menu and enter a condition value in the input field. 

    The screenshot below shows an example of a filter configuration:

    Step 4. Once the filter is configured, click the APPLY button to save your configuration.

    In the report

    If you want to preset a filter in your report, we recommend the following approach:

    1. Configure the filter via UI.
    2. Save the report

    Your report will now contain the filter configuration. If needed, you can edit the filter configuration programmatically. To learn more, see the API reference:

    Using API calls

    To set or change the filter at runtime, use the setFilter() API call:

    pivot.setFilter("Country", {
    query: {
    begin: "U",
    },
    });

    You can view the existing filter configuration using the getFilter() method.

    Live example

    Filter by condition can also be combined with the filter by selection. For more information, visit the Advanced tips guide.

    Clearing the filter

    Learn how to clear the filter by condition:

    Via UI

    Step 1. Open the filter view by clicking the field’s name or using the field’s context menu.

    Step 2. Select the Clear filter option located in the lower-right corner of the subview:

    Step 3. Click the APPLY button to save your changes.

    Using API calls

    You can clear all filters from a field using the clearFilter() API call. For example:

    pivot.clearFilter("Country");

    Live example

    See also