Creating a conditional or dependent filter

You can create a conditional or dependent custom filter for a dashboard. This type of filter is created based on an existing filter to refine its filtering conditions. You can add multiple conditions and specify both static and data definitions values.

Before you begin

  • Ensure that the direct or independent filter that you want to use in the dependent filter is already created.
  • You can enable multiselect filter option only for filters that you plan to apply to JDBC widgets or dashboards that contain manual data definition. The published widget or dashboard displays a drop-down list filter where you can select multiple filter values. To enable multiselect filter option, the following conditions must be satisfied:
    • The multiselect filter is only supported for all the widgets or dashboards that contain JDBC manual data definitions. JDBC connector supports third-party databases such as Db2, Oracle, PostgreSQL, MySQL, MSSQL, H2, and Derby.
    • The JDBC manual data definition in the widget, dashboard, or dependent filter must contain an IN operator and the filter name must be surrounded by single quotation marks, when the column name for the IN clause contains String or VARCHAR data type. If the column name contains numeric data type, then you must not surround the filter name by single quotation marks.

      Example of manual data definition that contains String or VARCHAR data type:

      • SELECT <column_names> FROM <table_name> WHERE <column_name> IN ('{filterName}')
      • SELECT SALES, PROFIT FROM SALES_DATA WHERE REGION IN ('{region}')

      Example of manual data definition that contains numeric data type:

      • SELECT <column_names> FROM <table_name> WHERE <column_name> IN ({filterName})
      • SELECT EMPLOYEE, DEPT FROM EMPLOYEE_DATA WHERE EMP_AGE IN ({age})
    • For direct or independent filter that is based on a data definition, the data definition must retrieve distinct values only.
    • The widget or dashboard must contain Drop-down List and Drop-down List with Search filter controls only.
  • Multi select filter option is not supported the following widgets or dashboards:
    • Transformation widgets, even if the widgets contain JDBC manual or assisted data definitions.
    • Widgets or dashboards that contain JDBC assisted data definitions.
    • Widgets or dashboards that contain data sources other than the data sources supported by the JDBC connector.
    • Widgets or dashboards that contain default filters, hidden filters, or Text Field filter control.

Procedure

Complete the following steps to create a conditional or dependent filter:

  1. In the navigation pane of Dashboard Designer, click Filters > Custom > Create New Filters.

    The New Filter page opens.

  2. Click the Edit Edit icon that is displayed next to the New Filter field, and enter a name for the filter.
    Note: Only alphanumeric and underscore characters are supported.
  3. In the Filter Label field, enter a label for the filter.
    Note: Filter label can be maximum 25 characters in length. Only spaces, alphanumeric, and underscore characters are supported. The filter labels are displayed only when you attach the filters to widgets and dashboards and preview or publish the widgets and dashboards.
  4. Click Conditional/Dependent Filter.
  5. Optional: If you do not want a filter to be displayed on any dashboard, then select the Save As Hidden Filter checkbox.
  6. In the Parent Filters pane, complete the following steps:
    1. From the Category list, select a filter category that contains the filter to be refined.

      The Filters pane displays all the filters that are contained within the selected category.

    2. In the Filters pane, select a filter that you want to add conditions to.

      The Parent Filter field under the Filter Value Conditions pane displays the selected filter.

    If you want to define a condition for multiple filters within different categories, then you can repeat this step to add those filters.
  7. From the Value list, select any one of the following options:
    • To filter values in the parent filter based on the specified value, in the Value list, enter the value.

      The value that is entered must be a present in the parent filter.

    • To filter values in the parent filter based on any value, from the Value list, select Any other than specified.

      All the values in the parent filter are displayed.

  8. Based on the condition that is specified, you can complete any of the following steps:
    • To provide hardcoded values for filter display, click Specify Static Values, and complete the following steps:
      1. In the Value to be Parsed and Value to be Displayed fields, specify the values.
        Note: The value that is entered in the Value to be Displayed field is displayed on the dashboard where this filter is added.
      2. Click the Save Save icon.
      3. The values that you enter first in the Value to be Parsed and Value to be Displayed fields are set as default values. However, if you want a specific set of parsed and displayed values to be displayed as the default values in the dashboard filter, then click the Default default value icon against a row in filter.

        Repeat these steps to add more filter values.

      4. To modify or delete the parsed and displayed values that are already entered, complete any of the following steps:
        • To modify the values, click the Edit Edit icon that is displayed on that row.
        • To delete the values, click the Delete Delete icon that is displayed on that row.
    • To get the values for the filter from data definition, click Specify Values through a Store, and complete the following steps:
      1. From the Data Definition list, select a data definition that you want to filter.
      2. In the Value to be Parsed and Value to be Displayed fields, specify a column name that is used in the data definition.
      3. In the Default Value field, specify a value that matches with one of the values that are used in the data definition.
        Note: The value that is entered in the Value to be Displayed field is displayed on the dashboard where this filter is added.

    To add multiple conditions, click Add Another Condition.

    To delete an already created condition, click Delete Condition.

  9. To add a filter control, click an option under Filter Selection.
    Select a filter control based on the number of filter values.
    Note:
    • For a filter that is based on static values, you cannot select Text Field as a filter type.
    • To use Text Field filter control, the Data Definition must contain the term {filterParam}.

      For example, Select salary from employee where empid='{Parentfilter}' and empname like '%{filterParam}%'

      If '%{filterParam}%' is not used in the Data Definition, then the text search filter does not work.

    Only if you plan to use the filter for widgets or dashboards that contain JDBC manual data definitions, and if you want to select multiple filter values in the JDBC widgets or dashboards, then complete the following steps:
    1. Select the Enable Multiple Selections checkbox.
      Note: Multi select filter is not supported for Text Field filter control.
    2. To limit the number of filter values that can be selected, enter a value in the Maximum Selection Count field.
      Note: You can enter a value in the range 2 - 2000. However, selecting too many values hinders the performance of the dashboard. Hence, it is advisable to limit the number of selections to 200 values only.
    Whenever you publish the widget or dashboard on Engine, it displays the filter control along with checkbox next to each filter value. If the Maximum Selection Count field is left blank, then the filter control of the published widget or dashboard displays the Select All option to select all the filter values.

    For more information about applying the multi select filter, see Filtering dashboard and widget data by using filters, legends, and Zoom to tag

  10. To save the filter, click Save.
  11. In the Save Filter window, complete the following steps:
    • In the Name field, enter a name for the filter.
    • To save the filter to an existing category, click Existing category, select a category name from the drop-down list, and then click Save.
    • To save the filter to a new category, click New Category, enter a category name, and then click Save.

    To save the filter with another name, click the Save As option.

Results

The newly created custom filter is listed under Most Recently Created Filters in the navigation pane. The All Filters page displays the following audit trail details for each custom filter:
  • Custom filter name
  • Custom filter category
  • Date and time when the custom filter was first created, and the username of the user who first created the custom filter.
  • Date and time when the custom filter was last modified, and the username of the user who last modified the filter. Only the latest record is displayed.

What to do next

You can use filters in a widget or a dashboard. For more information, see the following topics: