2 Replies Latest reply on Sep 29, 2017 3:20 PM by Nicolas.Isambourg

    [PI Web API] How to calculate the minimum of 2 values in a batch

    Nicolas.Isambourg

      Dear Forum Members,

       

      In a batch request, I defined 2 requests to calculate the minimum value over a time range

       

      "1":{
              "Method": "GET",
              "Resource": "https://.../calculation/summary?webid={webId}&starttime=01/07/2017&endtime=08/07/2017&summarytype=minimum&expression=if 'Coil Id' = "06789" then Abs('Length' - 12500) else 10000000&selectedFields=Items.Value.Timestamp;Items.Value.Value"
      },
          "2":{
              "Method": "GET",
              "Resource": "https://.../calculation/summary?webid={webId}&starttime=01/07/2017&endtime=08/07/2017&summarytype=minimum&expression=if 'Coil Id' = "06789" then Abs('Length' - 12900) else 10000000&selectedFields=Items.Value.Timestamp;Items.Value.Value"
          }
      

      Then I need to calculate the minimum of both results.

      The timestamp of the minimum value will be used in sub requests to get values of AF attributes.

       

      "4":{
              "Method": "GET"
              "ParentIds": [
                  "1"
              ],
              "Parameters": "$.???.Content.Items[0].Value.Timestamp,
              "Resource": "https://.../streams/webid/recordedattime?time={0}&retrievalmode=auto&selectedFields=Timestamp;Value"
          }
      

      How can I calculate the minimum of 2 values and use the result in a sub request ?

       

      Thanks,

      Best regards,

      Nicolas