Use getDimensionFilters API

The API getDimensionFilters() of SAP Analytics Cloud, analytics designer returns an array of the current filter values of the specified dimension.

API Definition

getDimensionFilters(string | +DimensionInfo) : FilterValue[]
The following example shows how the API is used (sample call).
Sample Code
var values = Table_1.getDataSource().getDimensionFilters("COUNTRY"); // 'values' is an array of FilterValue objects

Each value in the array is an instance of either SingleFilterValue, MultipleFilterValue, or RangeFilterValue, which all inherit from FilterValue.

To work with such an instance, that is, to access its type-specific properties, it needs to be cast to the corresponding type first using the type property. Please see the following section.

Accessing Type-Specific Properties

Sample Code
var value = Table_1.getDataSource().getDimensionFilters("COUNTRY")[0];
switch (value.type) {
    case FilterValueType.Single:
        var singleValue = cast(Type.SingleFilterValue, value);
        console.log(singleValue.value); // can access the 'value' property now
        break;
    case FilterValueType.Multiple:
        var multipleValue = cast(Type.MultipleFilterValue, value);
        console.log(multipleValue.values); // can access the 'values' property now
        break;
    case FilterValueType.Range:
        var rangeValue = cast(Type.RangeFilterValue, value);
        console.log(rangeValue.from); // can access the 'from' property now
        console.log(rangeValue.to);   // can access the 'to' property now
        // further range properties: 'less', 'lessOrEqual', 'greater', 'greaterOrEqual'
        break;
    default:
        break;
}

Known Restrictions

  • Currently the API does not return time range filters.

  • In SAP BW backend systems you can create valid filters that are not supported by SAP Analytics Cloud yet, for example, mixing single, multiple, and range filters. As this API implementation is based on SAP Analytics Cloud capabilities, it is also not able to fully support all filters possible in SAP BW backend systems.

    In SAP BW backend systems you can create valid filters that are not yet supported by SAP Analytics Cloud. As this API implementation is based on SAP Analytics CloudSAP Analytics Cloud, it supports the capabilities of SAP Analytics Cloud.