Friday, November 15, 2013

Script Formula to find distict values from all the children of a node.

/*
This formula tries to find list of all the distinct property values for all the children of a parent node.
it helps to identify nodes that have different children with different property values.
*/

var cprt;
var childEnumerator = node.GetChildEnumerator();
while(childEnumerator.MoveNext()) {
    var propValue = childEnumerator.GetCurrent().PropValue("Custom.CPRTSchedule");
       if(cprt == null)
           cprt=propValue;
   
var re=new RegExp(propValue);
    if( re.test(cprt)==false)
         cprt=cprt+","+propValue;
   
}
if(!cprt)
    return(node.PropValue("Custom.CPRTSchedule"));
return cprt;

No comments:

Post a Comment