✆ UAE: +971 58 5616 616, ✆ USA:+14099168409,   ✉ info@insightcubes.com

Overview of the getDataSource() API and related methods and functions with SAP Analytics Designer

How to use the getDataSource() API and its methods and functions with SAP Analytics Designer

The getDataSource() function is used to return the corresponding data source whether from a Table, Chart, Geo Map Layer, or from a data frame and data binding, if the data binding has no data source undefined is returned. There are 36 functions used with the getDataSource() API, here is a brief overview of each function and some use cases:

1. collapseNode()– Collapses the specified dimension and hierarchy node. The dimension and hierarchy nodes specified by the selection is collapsed. Dimension name and selection (property-value pairs) are the two mandatory parameters.

2. copyDimensionFilterFrom()– Used to apply existing filters on several widgets. Source data dimensions filters copied from the source data source to the dimensions of the current data source. Data source is a mandatory parameter and dimension name is optional.

3. copyVariableValueFrom()– Used to copy the variable value from one, several, or all variables of a data source to another variable. Copies the variable value if specified and all variable values of the data source if no variable value is specified. Data source is a mandatory parameter and variable name is optional.

4. expandNode()– The specified dimension and hierarchy node expanded. Used to expand a hierarchy node, only one node can be expanded but it expands all the nodes in the hierarchy path. The dimension name and a property-value pairs selection are mandatory parameters.

5. getComments()– This method is deprecated, use Table.getComments() instead. Returns data source comments. Getting comments is only supported for tables at the time being. No mandatory or optional parameters apply.

6. getData()– Used to display key figure values. This improves performance by avoiding multiple requests to the backend. Returns the specific data cell value of a selection. A selection is consistent of property-value pairs specifying one row, column, or data cell. Selection parameter is mandatory.

Example:

Getting data from a selection

7. getDataExplorer()– Returns the data explorer of a chart or a table, applying it to any other widget’ data source the returned will be unidentified. no mandatory parameters apply.

8. getDataSelections()– Returns the key-value pair of each cell. Specifying the offset and the limit is optional. Has three optional parameters, selections as <string> or <string[]>, offset (integer), and limit(integer).

9. getDimensionFilters()– Returns an array of all filter values as FilterValue from the dimension filters of a dimension. (Advanced filtering is not supported). Mandatory parameter is dimension name.

10. getDimensionProperties()– Returns all available dimension properties of the specified dimension of a data source. Only supported on data sources from table widgets. Mandatory parameter is dimension name.

Example:

getDimensionProperties of the account

11. getDimensions()– All dimensions of the data source returned. Has no mandatory or optional parameters.

Example:

getDimensions from Table widget

12. getHierarchies()– All hierarchies of the dimension returned. Dimension name is a mandatory parameter.

Example:

getHierarchies()

13. getHierarchy()– Used to retrieve hierarchy variables. Hierarchy set on the dimension returned. Dimension name is a mandatory parameter.

14. getHierarchyLevel()– Used to customize the display Level of the Hierarchy of the dimension returned. Specify the dimension and hierarchy level that you would like to set or retrieve. Only tables and charts are supported with this method. Dimension name is the mandatory parameter.

15. getInfo()– Information about the data source is returned through a DataSourceInfo object containing information about the specified data source. Has no mandatory or optional parameters.

16. getMeasures()– All measures of the data sources is returned. Has no mandatory or optional parameters.

Example:

getMeasures()

17. getMember()– The member info object from a member ID is returned. Dimension name and member ID are mandatory parameters, and hierarchy info is optional.

Can be used as part of the planning API and getDataSource API. When using getMember() as part of getDataSource(), the current active hierarchy should be taken into consideration. If current active hierarchy is set to flat presentation, display memberId is sufficient as a parameter.

Example:

Table_1.getDataSource().getMember(“ENTITY”, “E1000”);

Returns the member info object

{id: ‘E1000’, description: ‘InsightCubes UAE’, dimensionId: ‘Entity’, …}

If the current active hierarchy of the dimension “Entity” is set in the widget, the full memberId should be placed as a parameter in the API function.

Table_1.getDataSource().getMember(“ENTITY”, “[ENTITY].[parentId].&[E1000]”);

18. getMemberDisplayMode()– The display mode for members of the dimension is returned. Dimension name is the only mandatory parameter.

19. getMembers() Members of the dimension are returned. Conducts a backend roundtrip. It is advised to use the available options parameter to limit the list of returned members. Dimension name is a mandatory parameter, and options (members options as a JSON object to method arguments) is optional.

Example:

getMembers

20. getRefreshPaused()– Used to enable or disable data refresh at runtime. Has no mandatory or optional parameters. Used with the following values of pause mode: PauseMode.On always pause refresh, PauseMode.Off aways refresh, PauseMode.Auto refreshes Active Widgets Only.

21. getResultMember()– The result member is returned. Dimension name and selection are mandatory parameters. getResultMember() Is used to get member specific information of the specified member. This function provides the ResultMemberInfo object which contains id, description, and parentId.

For a dimension which has attributes, the attributes will be provided as additional properties of the ResultMemberInfo object. This function does not conduct a backend trip, thus functions faster. Only the visible properties in the widget will be included in the resultMemberInfo object.

22. getResultSet()– Is an API method that is used to expose the dataSource of both chart and table widgets. User can specify the input parameter to filter the result, if non are mentioned, all data cells are returned. No backend trip, functions fast.

Example:

getResultSet

23. getVariableValues()– Get the values of a variable. Returns an array of all variable values as VariableValue objects. Each value in the array is an instance of either single, multiple or range value, which all inherit from VariableValue. To access its type-specific properties, cast the instance to the corresponding type first, using the type property. For accessing its type-specific properties, cast the instance to the corresponding type first, using the type property. Variable name is a mandatory parameter.

Example:

getVariableValues

24. getVariables()– All variables of the data source are returned as an array of all variables as VariableInfo objects. Has no mandatory or optional parameters.

In the example below, all variables names of a data source are printed to the browser console:

getVariables

25. isRefreshPaused()– This method is deprecated, use getRefreshPaused() instead.

26. isResultEmpty()– Returns whether the result of the data source query state is empty, that is, no data cells were returned. Has no mandatory or optional parameters.

27. openPromptDialog()–  The Prompt dialog for the model used by this data source is opened. Has no mandatory or optional parameters.

28. refreshData()– Simultaneously updates and refreshes data of the widgets associated with the data source. If you’ve added, updated, or deleted members, use DataSource.refreshData() if you need the chart or table to reflect the modified members. The Refresh Data script API can be used together with the Timer script API to refresh a widget periodically. Has no mandatory or optional parameters.

29. removeDimensionFilter()– Removes any filter that is set on the dimension without affecting Advanced Filters. Dimension name is a mandatory parameter.

Example:

removeDimensionFilter for the Account dimension

30. removeVariableValue()– The value of the variable of a variable of a data source is removed. Variable name is a Mandatory parameter.

31. setDimensionFilter()– Sets and overwrites any filter on the dimension except advanced filters. Using this method and passing only a member ID a roundtrip to the backend is performed to fetch the member’s description, but if a MemberInfo object is passed (it contains a description) instead of a member ID string, then no roundtrip to the backend is performed. Dimension name and member name (whether MemberInfo, MemberInfo[], MeasuresInfo, MeasuresInfo[], TimeRange, TimeRange[], FilterValue, or rangeFilterValue[]) are mandatory parameters.

Example:

setDimensionFilter for the Account dimension

32. setHierarchy()– The hierarchy on the dimension is set. Dimension and hierarchy name are mandatory parameters.

Example:

setHierarchy()

33. setHierarchyLevel()– The hierarchy level of the dimension is set. Operation ignored if the dimension or its hierarchy level is invalid. Dimension name is a mandatory parameter, level is an optional parameter.

Example:

setHierarchyLevel for the Account dimension

34. setMemberDisplayMode()– Display mode for members of the dimension is set. Operation not supported for Geo maps. Dimension name and member display mode are two mandatory parameters.

35. setRefreshPaused()– Enable or disable data refresh at runtime. Can be used with PauseMode | Boolean, or with the following values for PauseMode: PauseMode.On always Pause, PauseMode.Off always Refresh, PauseMode.Auto refresh Active Widgets Only . This operation is only supported for charts and tables. PauseMode (Auto, off, on) is a mandatory parameter.

Example:

setRefreshPaused false

36. setVariableValue()– Value of the variable for the data source on the application is set by default. Other rules apply depending on use case. Variable name and variable value (VariableValue, VariableValue[]) are mandatory parameters, options (SetVariableValueOptions: “A set of values to describe the variables to retrieve”) is optional.

If the variable supports single variable values, you can set a variable value as follows:

Example:

Table_1.getDataSource().setVariableValue(“VAR_NAME”, {value: “5”}); or, alternatively,

Table_1.getDataSource().setVariableValue(“VAR_NAME”, “5”);

If the variable supports excluding a single variable value, you can set the variable value as follows:

Example:

Table_1.getDataSource().setVariableValue(“VAR_NAME”, {exclude: true, value: “5”});

Recent Posts

Switch Themes in SAP Analytics Cloud

By leveraging the power of Theme Builder and integrating JavaScript and CSS, users can seamlessly tailor their dashboards’ appearance to align with specific brand guidelines and aesthetic preferences.

Ownership interface of the consolidation solution for SAP analytics cloud

Managing Ownership Structure

Explore how Consolidation Extension for SAC simplifies managing ownership structures, spanning from creating and editing scopes to assigning ownership methods and percentages for accurate consolidation.

Systems Check and Referential Integrity Interface

Learn how SAP Analytics Cloud’s Consolidation Extension ensures data accuracy with system checks and referential integrity, ensuring proper configuration and identifying inconsistencies in design.

account configuration guide for the consolidation extension

Account Configuration Guide

Detailed guide with automated checks and inconsistencies identification on account configure for automated eliminations, cascading behavior, currency conversions and other rules

Configuration Starter Kit

Summary of all the features and automated system integrity rules included in identifying issues with designs covering scope, currency, account, audit, flow and other dimensions

Get in Touch

Learn more and ask us About Our Cloud Consolidation Solution

Share This Post

Share this Page!

Share this with your network.

Want to Know More?

Get In Touch

Something isn’t Clear?


Feel free to contact us, and we will be more than happy to answer all of your questions.