cancel
Showing results for 
Search instead for 
Did you mean: 

Hirerachy variables in design studi0

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

TammyPowlas
Active Contributor
0 Kudos

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?

Former Member
0 Kudos

HI Tammy,

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

Thanks,

Varun

former_member265529
Contributor
0 Kudos

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

Former Member
0 Kudos

HI ,

Thanks for your reply . in my hierarchy i have couple of nodes . what if i want to capture one node and display in text box?

whatever you suggest that will give entire nodes i belive

please correct me if i am wrong

Thanks,

Varun

former_member265529
Contributor
0 Kudos

Hi varun,

If you want to select a single node from a hierarchy, you can use the tree component.

It is especially used for hierarchy node selection.

Thanks,

Poovarasan

Former Member
0 Kudos

HI ,

Actually that is not my requirement.

My requirement is i have a hierarchy variable .like below screenshot. so i need to capture each node(PA_PH,PA-CF, etc..)

After capturing need to keep in different text boxes

Hope you got it?

is there any script to capture those nodes and display?

Thanks,

Varun

former_member265529
Contributor
0 Kudos

Hi Varun,

There is no direct way to access all the nodes values in the hierarchy. You can only get all the values of nodes using getmembers() function on the infoobject that is assigned to the node.

Can you explain your requirement, why you want to show all the node values so we can think of a work around for that?

Thanks,

Poovarasan

Former Member
0 Kudos

HI,

Actually ,

I Need to Capture PA_PH as you see in above screenshot and display in text on landing page we have text boxes above KPI Ties as below

so on top of tiles i need to get these hierarchies as for now its static . but actually it should get data from backend shouldnt be static because all these are business units so might be naming convention will chnage instead of PA_PH it can be PA-PH. so user recomended get data from backend instead of static text

hope you got it?"

Thanks,

Varun

former_member265529
Contributor
0 Kudos

Hi Varun,

I think there is no need to get members from data source.

Since you are just showing the text or key of the members, you can access them based on the values you use in set text function of the text boxes showing measure value..

Let me know if you want any clarification in it.

Thanks,

Poovarasan

Former Member
0 Kudos

HI ,

Thanks for your reply.

i got it whatever your saying .but i would like to know what script we need to write in order to capture that node.

lets say i captured that variable using set variable and then how to keep that specific hierarchy text in different text boxes?

tetx.set text was giving me error

can you help me with the script please

Thanks,

Varun

former_member265529
Contributor
0 Kudos

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