cancel
Showing results for 
Search instead for 
Did you mean: 

Getting all members of a dimension in SAP Analytics Cloud Analytics Application

ksg_sap
Discoverer
0 Kudos

I am trying to loop through all the elements of a dimension in an SAC Analytics Application. I tried to use getDataSource().getMembers() method to return all the members, but it looks like only the unique ones are returned by this method. Can you please let me know how I can obtain ALL the members of a dimension? Thanks a lot for your time!

anne-petteroe
Community Manager
Community Manager
0 Kudos

Hello Shankar,

Welcome to the SAP Community! Thank you for visiting us to get answers to your questions.

Since you're asking a question here for the first time, I'd like to offer some friendly advice on how to get the most out of your community membership and experience.

First, please see https://community.sap.com/resources/questions-and-answers, as this resource page provides tips for preparing questions that draw responses from our members. Secondly, feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html as well, as that will help you when submitting questions to the community.

Finally, I recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

All the best,
Anne

Accepted Solutions (0)

Answers (3)

Answers (3)

N1kh1l
Active Contributor

ksg_sap

Below is the syntax of getMembers()

DataSource.getMembers(dimension: string | DimensionInfo, options?: integer | MembersOptions JSON): MemberInfo[]

Table_1.getDataSource().getMembers by default returns 200 members as this is the default parameter.

The below will return you 3 records. So you can adjust this number to get the required number of records from dimesnion.

Table_1.getDataSource().getMembers("Location_4nm2e04531", 3);

OR

Table_1.getDataSource().getMembers("Location_4nm2e04531", {limit: 3});

In addition, you can specify the access mode, that is, whether the returned data is from master data (the default) or booked values.

Table_1.getDataSource().getMembers("Location_4nm2e04531", {accessMode:
MemberAccessMode.MasterData});
Table_1.getDataSource().getMembers("Location_4nm2e04531", {accessMode:
MemberAccessMode.BookedValues});

Hope this helps !!

Nikhil

ksg_sap

ksg_sap
Discoverer
0 Kudos

Hello Nikhil,

Thanks for your reply. I tried your suggestion. However, I am not able to get all the members in a dimension. I have tried both Access modes MasterData and BookedValues. Both return only the unique members in the dimension. I would like to get ALL the members (not just the unique ones). I am also open to using another method to solve the issue. Please help!

Regards

Shankar Ganesh

gfogel
Discoverer
0 Kudos

Referring to your planning model instead to your preselected table helps. But you still must pass a limit parameter or you´ll get only the default first 200 members. Here a sample code:

var all_members_product = planning_model.getMembers("PRODUCT", {limit: 20000});

sandip_kumar003
Active Participant
0 Kudos

Hi,

You can go with this code to get all the members of a dimension in the Analytic Application.

Best Regards,

Sandip Kumar.

ksg_sap
Discoverer
0 Kudos

Dear Sandeep,

The code you suggested will work, provided that all the members in the Dimension 'Region' are unique. If there are repetitions, it will only return the unique Regions. This leads to the problem that we have only a fraction of the original data. In your example, how can we make sure that all the entries of Region are returned one to one without filtering unique values?

Regards

Shankar Ganesh