The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
BWHITAKER
1 year agoNew Contributor III
Parent Name using UD8 Formula
Has anyone been able to successfully obtain a parent name for a member, within a UD8 formula without needing to leverage a text field on the member (using Parent Sort Order for example)?
As an exam...
- 1 year ago
Ok, I tested it myself and parent sort order does not influence / determine the order within the list when the GetParents function is used. It seems that the member ID is driving this. Do not rely on this as the member ID can differ between applications for the same members.
I did look into the member properties that can be used but did not find any that includes the parent sort order that can be used to sort the list directly (something like list.sortBySortOrder).
You can, however, use this:
Api.Entity.ParentSortOrder()This pulls the sort order number of a given member under a parent. You can then use this to determine the member using the sort order number you want. Not as pretty as I was hoping for but maybe someone here has a more pretty version of that in mind.
If you go down that route, make sure to document this well so that no one will ever set up a member without setting the sort order as needed.
Another edit:
Having said that, using a text field might be the superior solution. Depending on your exact use case of course. With a text field you can pull the desired parent directly from your member. No loop, just a single rule line.
With the above, one needs to pull the parents into a list, loop through the list and then use the one with the lowest parent sort order number (or whatever number one specifies).Text attributes seem more user friendly, less error-prone and easier to maintain to me without knowing all the requirement details.
Henning
OneStream Employee
1 year agoNot a bad idea, I never thought about that - i.e. I have never tested that. You could test it with a couple of parents and then write the parent list into the error log to see whether the parent sort order influences the order in the list. But I do recommend some alternating tests to really make sure it works and to rule out any accidental behavior that appears to be similar.
Henning
OneStream Employee
1 year agoOk, I tested it myself and parent sort order does not influence / determine the order within the list when the GetParents function is used. It seems that the member ID is driving this. Do not rely on this as the member ID can differ between applications for the same members.
I did look into the member properties that can be used but did not find any that includes the parent sort order that can be used to sort the list directly (something like list.sortBySortOrder).
You can, however, use this:
Api.Entity.ParentSortOrder()This pulls the sort order number of a given member under a parent. You can then use this to determine the member using the sort order number you want. Not as pretty as I was hoping for but maybe someone here has a more pretty version of that in mind.
If you go down that route, make sure to document this well so that no one will ever set up a member without setting the sort order as needed.
Another edit:
Having said that, using a text field might be the superior solution. Depending on your exact use case of course. With a text field you can pull the desired parent directly from your member. No loop, just a single rule line.
With the above, one needs to pull the parents into a list, loop through the list and then use the one with the lowest parent sort order number (or whatever number one specifies).
Text attributes seem more user friendly, less error-prone and easier to maintain to me without knowing all the requirement details.
Related Content
- 2 years ago