hierarchy.ungroup
Removes an element from under one parent in a hierarchy. It's the reverse of hierarchy.group.
What happens to the child depends on where else it sits:
- Under other parents too: it's only removed from the parent you name, and stays under the others.
- A leaf with no other parent: it leaves the hierarchy. If it isn't in any other hierarchy, it becomes an orphan.
- A parent with no other parent: it's left detached, with its children still under it. A detached parent isn't saved, so it and any parents below it are lost when the dimension is next loaded from disk, for example after a server restart, and the leaves below it become orphans.
Removing a parent
This function is meant for leaf elements. To remove a parent from a hierarchy, use hierarchy.unwind, which removes it and everything below it.
The child must be directly under that parent. Elements at the top level of a hierarchy can't be removed this way; use hierarchy.unwind for those. To remove a leaf element from the dimension altogether, including from every hierarchy, use element.delete.
hierarchy.removeChild does exactly the same, but returns true or false instead of a message.
js
hierarchy.ungroup(dimension, hierarchy, parent, child)Parameters
| Parameter | Type | Description |
|---|---|---|
dimension | string | The dimension's name. |
hierarchy | string | The hierarchy's name. |
parent | string | The parent element's name. |
child | string | The child element's name. |
Returns
stringAn empty string when it succeeds, or an error message saying why it failed, such as when the dimension, hierarchy, parent or child can't be found, or the child isn't directly under that parent.
Examples
js
hierarchy.ungroup("Account", "Profit and Loss", "Total Revenue", "600010");