Symptom
We are using setScaleUnit function to convert the numbers in absolute/thousand/millions. This function works well when called directly but does not work when called after setDimensionFilter().
Environment
SAP Analytics Cloud
Reproducing the Issue
Trigger the following script, the setScaleUnit() does not work:
Table_1.getDataSource().setDimensionFilter();
......
Table_1.getNumberFormat().setScaleUnit();
Cause
When calling setScaleUnit for new measures, these new measures have not yet been applied to the table, so setScaleUnit is not truly applied to the new measures. In a script event, if operations that process data on the same widget (such as setDimensionFilter, setScaleUnit) are called consecutively, the backend will handle the data uniformly after executing the last script API related to data.
Resolution
Add a getResultSet before the setScaleUnit API, which will update the table data.
Table_1.getDataSource().getResultSet()
Or
Table_1.getDataSource().refreshData()
Keywords
setScaleUnit, SAP Analytics Cloud, Unified Story Scripting, data analysis, visualization, script, scale unit, dimension filter, table data, refreshData , KBA , LOD-ANA-UNS-SCR , Unified Story Scripting related Issues , Problem
SAP Knowledge Base Article - Public