Using Script APIs in Different Model Types

With the introduction of a new model type in SAP Analytics Cloud, script API adaptions had to be made.

As models can now have both an account structure and a measure structure, it is necessary to ensure that script APIs work consistently with all different types of models.

In the following table you can see which structure or structure members are affected for which model by several APIs:
Model with... Accounts only Measures only (including new models without accounts) Measures and Accounts
Alias.MeasureDimension resolves to: accounts measures measures
DataSource.getMeasures returns: accounts measures measures
Chart.get/add/removeMeasure (deprecated) operates on: accounts measures accounts
Chart.get/add/removeMember (new) operates on: accounts measures accounts
DataSource.getDimensions returns: all dimensions including account dimension all dimensions including measure dimension all dimensions including account and measure dimension
Table/Chart.getSelections can contain: Alias.MeasureDimension (for accounts) Alias.MeasureDimension (for measures) Alias.MeasureDimension
Note
Please read the following explanations relating to
  • DataSource.getMeasures: There won't be a DataSource.getAccounts function, as you can always get the account members by using getMembers on the account structure

  • Chart.getMeasures/addMeasure/removeMeasure: These functions have been marked as deprecated. The reason for that is that they might be misleading (as you can see in the table above). In case of both measures and accounts this will operate on the accounts on the feed although the function is called ...Measures