cancel
Showing results for 
Search instead for 
Did you mean: 

Retreive dimension value from selection of crosstab using different datasource

Former Member
0 Kudos

Hi,

I'm relatively new to Design Studio.

Basically I'm trying to retreive a dimension value from Datasource A based on the selection of a crosstab using Datasource B.

As an example;

  • Datasource A contains dimensions name and locality and a measure.
  • Datasource B contains the dimension 'name' and measure - set as the datasource for a crosstab.

The names are found in both DS A & B.

I want to click on the crosstab (using Datasource B) and use the selected member in order to get the locality from datasource A.

The above can be done with getData(measure, selection) method but this only applies to measures. Is there something similar which applies to Dimensions?

Thanks & Regards,

Steven

TammyPowlas
Active Contributor
0 Kudos

Hi Steven,

Have you searched for this? There are plenty of examples here on the site - this is just one: https://archive.sap.com/discussions/thread/3696466

Former Member
0 Kudos

Hi Tammy,

As an end result I would like to display the dimension in a text field (Something i should have mentioned above). I am able to filter the other data source on clicking a row in the crosstab, but I cannot seem to retreive the dimension value.

Thanks,

Steven Farrugia

Accepted Solutions (0)

Answers (3)

Answers (3)

MustafaBensan
Active Contributor

Hi Steven,

If your data source is either BW or HANA, you should be able to apply the concept of cascading filters to retrieve the desired dimension value with the following script code:

var myName = CROSSTAB.getSelectedMember("Name");
DS_A.setFilter("Name", myName);
var myLocalities = DS_A.getMembers("Locality",1);
var myLocality = myLocalities[0];  // The assumption is that each "Name" member only has one corresponding "Location" member in the data source

For the above approach to work you should make sure the "Name" and "Locality" dimensions have the Members For Filtering option set to "Posted values only" in the Initial View of the data source.

Regards,

Mustafa.

Former Member
0 Kudos

Hi Mustafa,

Datasources are being created through BW.

As you suggested the method seems to be ignoring the filtered dimension value. It appears to be retreiving the first dimension value in the locality column. The data source is being filtered, but the text field is not being set to the corresponding locality.

Regards,

Steven Farrugia

MustafaBensan
Active Contributor
0 Kudos

Hi Steven,

Did you check that the "Name" and "Locality" dimensions have the Members For Filtering option set to "Posted values only" in the Initial View of the data source?

Regards,

Mustafa.

Former Member

Hi Mustafa,

All seems to be working fine. I forgot to add the Members for Filtering for the 'Locality' dimension, hence the undesired behavior.

Thank you!

Regards,

Steven Farrugia

Vidhya
Active Participant
0 Kudos

Hi Steven,

As per your requirement ,please try this below script,

DS_1.setFilter(dimension, CROSSTAB_1.getSelectedMember(dimension).internalKey);

TEXT_1.setText(DS_1.getMembers("dimension", 1).pop().text);

Kindly let me know if you are facing any issue.

Regards,

Vidhya.C

Former Member
0 Kudos

Hi Vidhya,

The code provides the correct output once, but clicking on another row does not retreive the new corresponding locality dimension.

Code used;

DS_1.setFilter("_rnSiEFfCEeaHDfvmMb4H4Q",CROSSTAB_2.getSelectedMember("_rnSiEFfCEeaHDfvmMb4H4Q").internalKey);
TEXT_3.setText(DS_1.getMembers("_rnZPwFfCEeaHDfvmMb4H4Q", 1).pop().text);

Regards,

Steven Farrugia

former_member265529
Contributor
0 Kudos

Hi Steven,

What is the source of your datasource? Is it BW or universe?

Most likely the data will be maintained in system in a common structure as a dimension with attributes.

In your case locality will be a attribute to the name in the source system. So you can use below code to get locality on selection of name in crosstab.

CROSSTAB_1.getSelectedMember("Name").getAttributeMember("Locality");

Thanks,

Poovarasan

Former Member
0 Kudos

Hi Poovarasan,

Thank you for your reply above.

Unfortunately the client has not set the locality as an attribute. I just need to use the selected crosstab dimension value to retreive another dimension value from another datasource.

Thanks,

Steve Farrugia