Skip to Content
avatar image
Former Member

Retreive dimension value from selection of crosstab using different datasource

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 08, 2017 at 01:36 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Mustafa Bensan

      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

  • avatar image
    Former Member
    Feb 08, 2017 at 01:11 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • Feb 08, 2017 at 01:25 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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