Hi DRM users,
I'm fairly new to DRM and just beginning to learn JavaScript, so I am reaching out in hopes someone can share a bit of wisdom here.
Basically, we have an existing sort order property that works, but I'd like to enhance it further so we can control the order of shared nodes in a given hierarchy.
Here's what our current Sort Order propery logic looks like:
IF(Equals(PropValue(Core.SharedFlag_MDM),False),9999999,Add(Multiply(PropValue(Core.Level),10000),PropValue(Core.SortOrder)))
The above works, but it applies the same high sort order value to all Shared nodes as a way to prevent them from ever coming before the Primary. The logic I need to apply to meet the new requirement will not work with DRM functions, so I imagine I'll need to apply JavaScript property logic.
Here's my best shot at explaining the Sort Order logic I'm going after (portion in Red is my main focus):
If Node = Primary,
Add(Multiply(PropValue(Core.Level),10000),PropValue(Core.SortOrder))
If Node = Shared,
Determine the max value:
1) Sibling members' SortOrder values ((Core.SortOrder + (Core.Levelx10000)), and where the sibling is another Shared Node, reference the
Primary instance of said Shared Node for the same SortOrder value ((Core.SortOrder + (Core.Levelx10000))
-- to be clear, I want to reference the max SortOrder value among all siblings (or primary instances of those siblings if they are shared)
2) Multiply(PropValue(Core.Level),10000),PropValue(Core.SortOrder)) + 1
Any help would be much appreciated!
Thanks