AnsweredAssumed Answered

Need Help with Batch

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

Hi,

 

Before I actually go into my batch issue, I'd like to first state what I am trying to do so that if there is a better way of accomplishing it, I'd like to learn how to do it. In PI System, we have elements that are Equipment Centers with template name "Packaging Sub Area". They are all sub-elements of the "Packaging". Underneath these equipment centers there are elements that are the actual equipment and the number of each pieces of equipment under each equipment center varies. Some equipment centers have 1 piece of equipment, while others may have 9. I am trying to get the attributes of each equipment element. Here is how I go about getting them.

 

{
     "GetAreaInfo": {
     "Method": "GET",
     "Resource": "https://localhost/piwebapi/elements?path=\\\\AfServer\\AfDatabase\\AreaName&selectedFields=WebId;Name;Path;Links.Elements"
     },
     "GetPackagingAreaInfo": {
     "Method": "GET",
     "Resource": "{0}?nameFilter=Packaging&selectedFields=Items.WebId;Items.Name;Items.Path;Items.Links.Elements",
     "ParentIds": ["GetAreaInfo"],
     "Parameters": ["$.GetAreaInfo.Content.Links.Elements"]
     },
     "GetPackagingAreaEquipmentCenters": {
     "Method": "GET",
     "Resource": "{0}?searchFullHierarchy=true&selectedFields=Items.WebId;Items.Name;Items.Path;Items.Links.Elements;Items.Links.Attributes;&templateName=Packaging%20Sub%20Area",
     "ParentIds": ["GetPackagingAreaInfo"],
     "Parameters": ["$.GetPackagingAreaInfo.Content.Items[*].Links.Elements"]
     },
     "GetPackagingAreaElementList": {
     "Method": "GET",
     "RequestTemplate": {  "Resource": "{0}?selectedFields=Items.WebId;Items.Name;Items.Path;Items.Links.Elements;Items.Links.Attributes" },
     "ParentIds": ["GetPackagingAreaEquipmentCenters"],
     "Parameters": ["$.GetPackagingAreaEquipmentCenters.Content.Items[*].Links.Elements"]
     }
}




 

The above batch POST works and produces a nested list of equipment elements for "GetPackagingAreaElementList" method. When I tried adding the below method to the above batch script, I couldn't get it to work. I suspect that I am referencing/traversing the sublists in a wrong way. (Line 5 below).

 

"GetPackagingAreaElementAttributes": {
"Method": "GET",
"RequestTemplate": {  "Resource": "{0}?searchFullHierarchy=true&selectedFields=items.Name;items.WebId;items.Path;items.IsHidden;items.IsExcluded;items.ConfigString" },
"Parameters": ["$.GetPackagingAreaElementList.Content.Items[*].Content.Items[*].Links.Attributes"]

 

 

 

Can you guys help with this please?

 

Thanks.

Outcomes