Using Range and Exclude Filters

The script API DataSource.setDimensionFilter() supports range filters and exclude filters.

Exclude Filters
You can filter out members from the drill-down with exclude filters. The following examples show the use of exclude filters:
  • In the following example, a single filter value is set for dimension "EMPLOYEE_ID". This keeps only the member with employee ID 230 in the drill-down:
    Sample Code
    DS_1.setDimensionFilter("EMPLOYEE_ID", {value: "230"});
  • In the following example, a single but excluding filter value is set for dimension "EMPLOYEE_ID". This removes the member with employee ID 230 from the drill-down:
    Sample Code
    DS_1.setDimensionFilter("EMPLOYEE_ID", {value: "230", exclude: true});
  • In the following example, multiple filter values are set for dimension "EMPLOYEE_ID". This keeps the members with employee IDs 230 and 240 in the drill-down:
    Sample Code
    DS_1.setDimensionFilter("EMPLOYEE_ID", {values: ["230", "240"]});
  • In the following example, multiple but excluding filter values are set for dimension "EMPLOYEE_ID". This removes the members with employee IDs 230 and 240 from the drill-down:
    Sample Code
    DS_1.setDimensionFilter("EMPLOYEE_ID", {values: ["230", "240"], exclude: true});
Range Filters
You can filter ranges of members in the drill-down with range filters.
Note
Please note the following when using range filters:
  • Range filters can only be applied to numeric dimensions.

  • A time dimension is not a numeric dimension.

  • SAP BW does not support numeric dimensions.

The following examples show the use of range filters:
  • In the following example, the range filter applied to dimension "EMPLOYEE_ID" keeps the members with employee IDs between 230 and 240 in the drill-down:
    Sample Code
    DS_1.setDimensionFilter("EMPLOYEE_ID", {from: "230", to: "240"});
  • In the following example, the range filter applied to dimension "EMPLOYEE_ID" keeps the members with employee IDs less than 230 in the drill-down:
    Sample Code
    DS_1.setDimensionFilter("EMPLOYEE_ID", {less: "230"});
  • In the following example, the range filter applied to dimension "EMPLOYEE_ID" keeps the members with employee IDs less or equal than 230 in the drill-down:
    Sample Code
    DS_1.setDimensionFilter("EMPLOYEE_ID", {lessOrEqual: "230"});
  • In the following example, the range filter applied to dimension "EMPLOYEE_ID" keeps the members with employee IDs greater or equal than 230 in the drill-down:
    Sample Code
    DS_1.setDimensionFilter("EMPLOYEE_ID", {greaterOrEqual: "230"});
  • In the following example, the range filter applied to dimension "EMPLOYEE_ID" keeps the members with employee IDs greater than 230 in the drill-down:

    Sample Code
    DS_1.setDimensionFilter("EMPLOYEE_ID", {greater: "230"});
  • You can also apply multiple range filters at once.

    In the following example, the range filter applied to dimension "EMPLOYEE_ID" keeps the members with employee IDs less than 230 and greater than 240 in the drill-down:

    Sample Code
    DS_1.setDimensionFilter("EMPLOYEE_ID", [{less: "230"}, {greater: "240"}]);