This component uses hierarchies from BW. It could be adapted to connect to Hana or a Universe, but these hierarchies have not been tested.
The component has been tested, but you may encounter some bugs. For either bugs or enhancement request, do not hesitate to post an “issue” on our GitHub.
Hi, I am Franck BLAIS, Sap BW Consultant and Design Studio developper. I already posted 2 blog entries on my component “Hierarchical Menu” in the SDK Community package initiative.
I want to share a new aspect on the menu, a utility one.
In Design studio, as far of the 1.6, you can access members of a dimension, but the hierarchy members. I juste improved the “Hierarchical Menu v 1.0” with this functionality.
Rendering the hierarchical menu is not necessary and it can be used in a Utility version.
An demo application can be found here. You just need to import it. Note it’s for DS 1.6 and the datasource are CSV.
Component overview and explanations
The hierarchical menu look like this, with the embedded CSS:
You can avoid to display it by using the method “hideMenu(boolean hide)”, or changing its value directly in DS.
With the iterator, you can really easily create a navigation menu using the Tree 2.0 (or any other component, like dropdown, listbox …):
When you have assigned a Datasource and selected a dimension with a hierarchy, you can now use 3 new methods detailed below.
Loop on the members with getHierarchyMembers()
This method returns an array of Hierarchy Member that you can iterate using forEach.
Each member has for attributes (case-sensitive):
|an integer internal ID generated while exporting it. It is corresponding to the index of each node/leaf. (The fist node will be 0, second 1 …)|
hierarchy node key in BW format. It can be used as parameter for setFilter of setVariable on a characteristic with a hierarchy assigned.
Contains the text of the node/leaf, but not only. You see, it depends on the characteristic display mode.
In contrary of the key, which is the NodeKey (HIERARCHY_NODE/0HIER_NODE/EUROPE), this node would have:
If you choose to display both (Key+Text) in BEX, then the attribute text will have the concatenation of both like: “EUROPE|Europe”. Only Text will give only “Europe” while Text+Key “Europe|EUROPE”.
if you need to access one of the other, you can always use “Convert.split” or the substring extractor. Or best bet: display the hierarchy as “Text” only 🙂
|Level||Depth of the node, starts at 0.|
ID of the parent node, -1 if no parents.
You can directly access the parent form the table by using this ID as index:
|parentKey||parentKey in BW hierarchy format. Can be used in setFilter, setVariable or setDataSelection.|
|isLeaf||Boolean, tells you if you on a node or a leaf basically, meaning you cannot go further in this branch.|
|nodeState||Indicated wherever the node is collapsed (COLLAPSED) or expanded (EXPANDED) in the datasource. For a leaf, nodeState = leaf.|
|type||Type of the node, exactly the same as BW, either: HIERARCHY_NODE or t)he technical name of the characteristic (0MATERIAL for example)|
2 other methods are available, maybe less useful:
return the DS table as a string, could be useful to debug the component …
Return the same table, but as a JSON String.
It could be used in conjonction with the Collection component, maybe to alter the structure, values and still be able to loop and access the hierarchy members.
I can now only hope you’ll like, and of course, use it !
Let me know if you found any bug, or need support.