Skip to Content
avatar image
Former Member

Get dimension values with getMembers?


I have a data source with the following dimensions in my SAP Design Studio dashboard:

Key 1 (String)

Key 2 (String)

Measure 1 (int)


Description 1



Description 2



Description 3



Description 4


I would really like to display the different keys in text fields because I am going to display the descriptions. After a heavy amount of searching online, I have come to an understanding that getting dimension values is quite difficult. (I am not trying to get the measure which easily can be obtained with the DS_1.getData() method)

A work around I have found is to use the following code:

var Dim_For_Description= DS_1.getMembers(Dimension, 100); 

Dim_For_Description.forEach(function(Dim_Desc, Dim_i) { 

if(Dim_i==1){Desc_1= Dim_Desc.internalKey;}

else if(Dim_i==2){Desc_2= Dim_Desc.internalKey;}

else if(Dim_i==3){Desc_3= Dim_Desc.internalKey;}

else if(Dim_i==4){Desc_4= Dim_Desc.internalKey;}

else if(Dim_i==5){Desc_5= Dim_Desc.internalKey;}

else if(Dim_i==6){Desc_6= Dim_Desc.internalKey;}

else if(Dim_i==7){Desc_7= Dim_Desc.internalKey;}

else if(Dim_i==8){Desc_8= Dim_Desc.internalKey;}

else if(Dim_i==9){Desc_9= Dim_Desc.internalKey;}

else if(Dim_i==10){Desc_10= Dim_Desc.internalKey;}


The problem is that the DS_1.getMembers() sorts the members alphabetically while I need them to be according to the sorting in the DS.

Is there any work-sround for this problem?

I am using Design Studio 4.1

Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 10, 2015 at 05:26 PM

    Hi Martha,

    It is a known limitation of the getMembers() function that the sort order is based on the master data and not the data source.  I don't believe there is a workaround to get the data source order.

    Can I ask why you don't just display the data in a Crosstab component?



    Add comment
    10|10000 characters needed characters exceeded

    • No problems, Martha.  I hope you are able to achieve the desired result.  As an additional point, if you need to loop through the collection in a particular order, you can apply the sortByKey(), sortByLabel() or sortByValue() methods.