Skip to Content
0

Retreive dimension value from selection of crosstab using different datasource

Feb 08, 2017 at 11:14 AM

156

avatar image

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

10 |10000 characters needed characters left characters exceeded

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

0

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

0
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Mustafa Bensan Feb 08, 2017 at 01:36 PM
1

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.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

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

0

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.

0

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

1
Poovarasan Boopalan Feb 08, 2017 at 01:11 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0
Vidhya V Feb 08, 2017 at 01:25 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0