How to get the value of the current hierarchy value name

Hi,

I have a full hierarchy, how can I get the value and not the key of the current selected member. I’ve tried this: this.parentView.control.getViewParameterByName(‘viewParamFuncional’).parameterValue.values[0].uniqueName

But I got this: “2…classi_func”

This seems to be the key of the hierarchy member, so how can I use this to get the name of the member?

If you wish to get the captions of the hierarchy members, you’ll need a second call to get the hierarchy, then match the ancestry with the hierarchy to get the captions, otherwise you’ll only have the unique names. In order to do this, you can use HierarchyService’s getHierarchyById method to get the hierarchy you want, passing the uniqueName property from the MemberValue object you currently have as a parameter.

https://www.dundas.com/support/api-docs/js/#API%20Reference/dundas/data/HierarchyService/cindex.html

https://www.dundas.com/support/api-docs/js/#API%20Reference/dundas/data/HierarchyService/Methods/getHierarchyById.html

With that, you can retrieve the caption field from the hierarchy object.

https://www.dundas.com/support/api-docs/js/#API%20Reference/dundas/data/Hierarchy/cindex.html

https://www.dundas.com/support/api-docs/js/#API%20Reference/dundas/data/Hierarchy/Properties/caption.html

Hi @christian.pervan,

Can you please provide an example, the problem with API docs is that it doesn’t provide any examples!

Hey @luis.silva,

Unfortunately, I don’t have an example on me that I can share. As this is something that’s more complex, I would highly recommend engaging with our Professional Services team. Let me know if you’d like me to connect you with them!