Filtering
Core Filtering APIs
MemberInfo Objects: For more effective filtering, values can be provided as JSON-style objects containing both the ID and Description (e.g., {id: "value", description: "text"}) rather than simple strings.setDimensionFilter(dimensionId, values): The primary method for applying filters to a data source. It requires the technical ID of the dimension and an array of selected member IDs.removeDimensionFilter(dimensionId): Used to clear existing filters from a specific dimension.getSelectedKey() / getSelectedKeys(): Functions used on input widgets (like dropdowns or checkboxes) to retrieve the user’s current selection before passing it to a filter function.
Script Examples
-
Apply a Top & Bottom rank in the same chart
-
Write Single Dimension Filter value to a text box
-
Retrieve a Dimension Member Description from a table
-
Retrieve a single measure value selected by a user in a table
-
Use the first & last result / row value from a table as a filter
-
Filter to show the first row in a table
-
Filter a Chart or Table using a Check Box Group
-
Apply a filter using resultset values
-
Filter a table using a search string entered in an Input Field
-
Filter excluding specific values (all values are returned except those specified)
-
Apply a Filter with a multiple hardcoded dimension member values
-
Apply a Filter with a single hardcoded dimension member value
-
Apply a dimension filter using a dropdown list without triggering a data source query
-
Basic Dropdown onSelect code to filter a table by a selected dimension member or All values (no filter)
-
Get the Dimension Filter value applied to a table and set it as the selected key in a dropdown list
-
Adding the ‘All’ value to a dropdown
This example is part of a broader set of SAP Analytics Cloud scripting patterns, covering common use cases such as filtering, measure switching, and reacting to user selections.
