Symptom
In optimized story or application, for table with BW model, when using scripts to add a new dimension (the display mode is 'id and description') to rows and sort by it, the result is sorted by 'description'.
Environment
SAP Analytics Cloud 1.0
Reproducing the Issue
1,Create an optimized story or an application for testing.
2,Add a table with BW model.
3,Add a button and add below scripts to the button's onClick event. Make sure that the display mode of the newly added dimension is 'id and descrption':
Table_1.addDimensionToRows("0BC_CUST");
console.log(Table_1.getDataSource().getMemberDisplayMode("0BC_CUST"));
Table_1.sortByMember("0BC_CUST", SortOrder.Descending);
4,Save the story or the application and run it.
5. Click on the button and check the console log and the sorting result.
The member display mode in console log is 'Description' instead of 'DisplayIdAndDescription'. The '0BC_CUST' dimension rows are sorted by description instead of id and description.
Cause
The dimension is added before sorting, and the scripts are in one event. Although the dimension has been added, for Table.sortByMember API, it cannot get the display mode of the dimension. Then it is sorted by 'Description' defaultly.
Resolution
- A workaround is available. Please change the script as below:
Table_1.addDimensionToRows("0BC_CUST");
Application.setRefreshPaused([Table_1.getDataSource()], false);
console.log(Table_1.getDataSource().getMemberDisplayMode("0BC_CUST"));
Table_1.sortByMember("0BC_CUST", SortOrder.Descending);
- Our development team are investigating a fix for the issue. Due to a technical restriction, the fix won't be available soon. Once the fix schedule is defined, this KBA will be updated.
Keywords
KBA , LOD-ANA-UNS-DVP , Unified Story Developer Issues , LOD-ANA-AD , Analytics Designer , Problem