I am looking at building a tree map chart. In these chart data is grouped into sections. I’m looking at the best way to return data in a hierarchy so I can group accounts. Is it possible to use MDX to return data with a dimension hierarchy? I can then use this returned data to build the chart data object.
For example the parent level might be Cash cost. This as several children like labor and fuel. These children also have children, which are the leaf nodes or actual accounts.
My original though was to return the child elements using $tm1Ui.dimensionElements, and then to loop through these elements and return their children with the $tm1Ui.cubeExecuteMdx and some MDX. I can do both of these separately, however not one inside a loop of the other.
I think the issue here is that when I loop through the first level of elements and issue the MDX command, the loop does not wait for the result. Something to do with the promise.
What I want to know is, should I continue to head down this best path, or should I be looking at getting the dimension hierarchy and data with another method.