Count number of parent for Unstructured List
Hi Team,
I am trying hard to calculate the number of parents for individual list items for unstructured list items.
Kindly let me know in case of an optimized formula
IF NAME(PARENT(ITEM(Region_Group))) = "All Regions" THEN 1 ELSE IF NAME(PARENT(PARENT(ITEM(Region_Group)))) = "All Regions" THEN 2 ELSE IF NAME(PARENT(PARENT(PARENT(ITEM(Region_Group))))) = "All Regions" THEN 3 ELSE 4
this is not going to work if I add any other list item for more levels.
Thanking you in anticipation.
Answers
-
Seems like a simple system module will do the trick. If the Parent is not the top level = 0, if it does, then 1. Then all you have to do is sum up the 1's. Would that work?
Generally, it's not a good practice to use nested IF statements especially with hard coded values. Make sure the top level is a line item, not a hard coded value.
Need an example?
1 -
And please don't nest the PARENT function, please break it up. Also, please look into the Ancestor function.
0 -
Hi @JaredDolich,
Thanks for your response, I would be very happy if you can share one example of this because I tried but bcos of the unstructured list it's creating issues.0 -
Thanks for your response, yes I will make sure to avoid the nested parent functions.
0