Skip to Content
avatar image
Former Member

Hirerachy variables in design studi0

HI Experts,

searched blogs before posting

https://archive.sap.com/discussions/thread/3488299

I would like to capture hierarchy node variables and display in a text box.

I have total ten hierarchies

i tried get varaible and display in a text but no luck

could any please guide me

Thanks,

Varun

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Nov 09, 2016 at 05:01 PM

    Hi Varun,

    You can use the below code to get value of a hierarchy variable and set text.

    Text_1.setText(DS_1.getVariableValueText("VAR_HIER"));

    if it's not working then the variable does not have any value in it. So you need to give a default value to the variable in your query.

    Thanks,

    Poovarasan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Varun,

      You would have set the value for text boxes with data binding or scripting.

      1. If you have used scripting to load data, you can use the method below to set value and dimension value

      var array=DS_1.getMembers("dimension", maxNumber)

      TEXT_DATA1.setText(DS_1.getDataAsStringExt("measure", {"dimension",array[0].InternalKey));

      TEXT_DIM1.setText(array[0].text);

      TEXT_DATA2.setText(DS_1.getDataAsStringExt("measure", {"dimension",array[1].InternalKey));

      TEXT_DIM2.setText(array[1].text);

      Like you can write code for the four members in your members array.

      2. If you have set value by binding, you need to only set text for dimension members.

      var array=DS_1.getMembers("dimension", maxNumber)

      TEXT_DIM1.setText(array[0].text);

      TEXT_DIM2.setText(array[1].text);

      ......

      Thanks,

      Poovarasan

  • Nov 09, 2016 at 05:08 PM

    Have you seen Mustafa's reply here: https://archive.sap.com/discussions/thread/3730860 it is very comprehensive. Did you see it as part of your search?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      HI Tammy,

      Thanks for sharing . i didnt get this blog while searching .very helpful thanks for sharing

      Thanks,

      Varun