AnsweredAssumed Answered

Duplicate Results from Batch

Question asked by cageybee on Sep 26, 2018
Latest reply on Sep 26, 2018 by cageybee

I devised a process that gets all of the descendant elements from one particular element. I do it using the Batch controller. Here is how I do it:

 

I get down to the "Area" level, then look for the "Packaging" element, then for each "Line" under the "Packaging" element, I am asking for all of their descendants. The problem happens when I am asking for each "Line's" descendants. For example, mixed with the results from "Line 55", we have an element from "Line 37".

 

Here is my code:

 

{
     "getAreaElement": {
     "Method": "GET",
     "Resource": "https://localhost/piwebapi/elements?path=\\\\AfServer\\AfDatabase\\Area&selectedFields=WebId;Id;Name;Description;Path;TemplateName;Links.Elements;Links.Attributes"
     },
     "getPackagingAreaElement": {
     "Method": "GET",
     "Resource": "{0}?nameFilter=Packaging&selectedFields=Items.WebId;Items.Id;Items.Name;Items.Description;Items.Path;Items.TemplateName;Items.Links.Elements;Items.Links.Attributes",
     "ParentIds": ["getAreaElement"],
     "Parameters": ["$.getAreaElement.Content.Links.Elements"]
     },
     "getLineElements": {
     "Method": "GET",
     "Resource": "{0}?selectedFields=Items.WebId;Items.Id;Items.Name;Items.Description;Items.Path;Items.TemplateName;Items.Links.Elements;Items.Links.Attributes",
     "ParentIds": ["getPackagingAreaElement"],
     "Parameters": ["$.getPackagingAreaElement.Content.Items[*].Links.Elements"]
     },
     "getLineDescendants": {
     "Method": "GET",
     "RequestTemplate": {  "Resource": "{0}?searchFullHierarchy=true&maxcount=200&selectedFields=Items.WebId;Items.Id;Items.Name;Items.Description;Items.Path;Items.TemplateName;Items.Links.Elements;Items.Links.Attributes" },
     "ParentIds": ["getLineElements"],
     "Parameters": ["$.getLineElements.Content.Items[*].Links.Elements"]
     }
}

Outcomes