Symptom
In SAC script, the system throws errors when attempting to access the "value" property of object 'FilterValue' returned by getDimensionFilters().
The script is like the following:
var filter = Table_1.getDataSource().getDimensionFilters("Location_4nm2e04531")[0];
console.log(filter.value);
Environment
SAP Analytics Cloud
Cause
The "value" property cannot be accessed directly in the object type 'FilterValue' returned by getDimensionFilters().
Resolution
Cast the variable to the FilterValue subtype 'SingleFilterValue' or 'MultipleFilterValue' to access the value property. Note the check whether the object is of the correct target type before the cast operation.
Here is an example for type 'SingleFilterValue':
if (filter.type === FilterValueType.Single) {
var singleFilter = cast(Type.SingleFilterValue, filter);
}
console.log(singleFilter.value);
See Also
Keywords
SAP Analytics Cloud, script, javascript, story filter, getDimensionFilters, value property, runtime error, SingleFilterValue, FilterValue, scripting issue, API guide, casting, subtype, SAC integration, financial planning. , KBA , LOD-ANA-UNS-SCR , Unified Story Scripting related Issues , Bug Filed
SAP Knowledge Base Article - Public