on 05-03-2023 3:49 PM
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.