Symptom
- When you try to open a Story, an error related to Scripts displays "Script execution failed for event 'Story_Filter_Table.onResultChanged'".
- This error occurs after you update a hierarchy of a dimension, which is used in the Story filter.
Environment
SAP Analytics Cloud 1.0;
Reproducing the Issue
- Update the hierarchy of a dimension which is used in the filter of a Story.
- Try to open the Story.
- The Story is opened with an error "Script execution failed for event 'Story_Filter_Table.onResultChanged'" .
Cause
When all members are selected for the story filter, story filter will return empty array while your code doesn't handle the empty array.
Resolution
Update the code for the story filter to handle the empty array case. Below is code sample for a filter named "CountryStoryFilter":
==============================================================
var CountryStoryFilter = Application.getFileDataSource("C2sg0r00beqgdba6rgmgts5cf15").getDimensionFilters("EMEA_ISO_COUNTRY");
var CountryInputControl = ArrayUtils.create(Type.MemberInfo);
if (CountryStoryFilter.length === 0) {
var CountryMembers = Story_filter_table.getDataSource().getMembers("EMEA_ISO_COUNTRY");
Country_2.getInputControlDataSource().setSelectedMembers(CountryMembers);
} else {
if(CountryStoryFilter[0].type == "Single"){
var CountryStoryFilterValue = cast(Type.SingleFilterValue, CountryStoryFilter[0]).value;
CountryInputControl.push({id: CountryStoryFilterValue});
}
else if(CountryStoryFilter[0].type == "Multiple"){
var CountryStoryFilterValues = cast(Type.MultipleFilterValue, CountryStoryFilter[0]).values;
for (var k1=0; k1 < CountryStoryFilterValues.length; k1++){
CountryInputControl.push({id: CountryStoryFilterValues[k1]});
}
}
Country_2.getInputControlDataSource().setSelectedMembers(CountryInputControl);
}
==============================================================
Keywords
KBA , LOD-ANA-UNS-SCR , Unified Story Scripting related Issues , Problem
SAP Knowledge Base Article - Public