PI Web API NameFilter usage

HI ALL,

 

I would like to filter results on my streams interpolateattimes query created following below link

 

https://docs.aveva.com/bundle/pi-web-api-reference/page/help/controllers/stream/actions/getinterpolatedattimes.html

 

Below is sample response from query. Now, I want to filter results where Good is True. In the above document it is mentioned that we could use FilterExpression using '.' notation but I am unable to achieve it. can you provide exact syntax please?

 

Sample response:

{

"Items": [

{

"Timestamp": "2014-07-22T14:00:00Z",

"UnitsAbbreviation": "m",

"Good": true,

"Questionable": false,

"Substituted": false,

"Annotated": false,

"Value": 12.3

},

{

"Timestamp": "2014-07-22T14:00:00Z",

"UnitsAbbreviation": "m",

"Good": true,

"Questionable": false,

"Substituted": false,

"Annotated": false,

"Value": 12.3

}

],

"Links": {}

}

 

  • Thanks for the response. I've tried that, but somehow not giving expected result. Below is the result before and after adding BadVal('.')=0, it just removes Good status from result, but not excluding the attribute values which are Bad.

     

    Before:

     

     

    {

     "Items": [

      {

       "Name": "UnitOfMeasure",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|UnitOfMeasure",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": "%",

         "Good": true

        }

       ]

      },

      {

       "Name": "StorageLocation",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|StorageLocation",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": "0001",

         "Good": true

        }

       ]

      },

      {

       "Name": "ProductCode(SICC)",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|ProductCode(SICC)",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": "X2136",

         "Good": true

        }

       ]

      },

      {

       "Name": "Plant",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|Plant",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": "A017",

         "Good": true

        }

       ]

      },

      {

       "Name": "MeasurementPoint",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|MeasurementPoint",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": "FM01T181BDT",

         "Good": true

        }

       ]

      },

      {

       "Name": "Mass",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|Mass",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": {

          "Value": 248

         },

         "Good": false

        }

       ]

      }

     ]

    }

     

    After:

     

    {

     "Items": [

      {

       "Name": "UnitOfMeasure",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|UnitOfMeasure",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": "%"

        }

       ]

      },

      {

       "Name": "StorageLocation",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|StorageLocation",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": "0001"

        }

       ]

      },

      {

       "Name": "ProductCode(SICC)",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|ProductCode(SICC)",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": "X2136"

        }

       ]

      },

      {

       "Name": "Plant",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|Plant",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": "A017"

        }

       ]

      },

      {

       "Name": "MeasurementPoint",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|MeasurementPoint",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": "FM01T181BDT"

        }

       ]

      },

      {

       "Name": "Mass",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|Mass",

       "Items": [

        {

         "Timestamp": "2023-10-19T22:00:00Z",

         "Value": {

          "Value": 248

         }

        }

       ]

      }

     ]

    }

  • Hi (Missing Content)​ ,

     

    Below is the complete query structure.

     

    https://PIAFServer/piwebapi/streamsets/xxxxxxxxxx/interpolatedattimes?Time=t&timezone=Central%20European%20Standard%20Time&selectedFields=Items.Name;Items.Path;Items.Items.Timestamp;Items.Items.Value.Value;Items.Items.Good?filterExpression=BadVal(.)=True

     

     

  • Hi ​ ,

    Could you share the requesting URL? and if you have tried without selectedFields paramater...?

  • Thanks (Missing Content)​ .

     

    I've tried that. For most of the attributes, it shows "The Configured data reference for Attribute does not support filter expression". Even for PI tag referenced attributes giving bad values which are supposed to be filtered are showing "Performance equation parsing error". Is there any way we can handle these?

     

    Below is the result after trying:

     

    {

     "Items": [

      {

       "Name": "UnitOfMeasure",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|UnitOfMeasure",

       "Items": [

        {

         "Timestamp": "2023-10-22T22:00:00Z",

         "Value": null,

         "Good": false,

         "Errors": [

          {

           "FieldName": "Value",

           "Message": [

            "The configured data reference for 'Attribute 'UnitOfMeasure' in Element 'Equipment1' in Element 'Asset1'' does not support filter expressions."

           ]

          }

         ]

        }

       ]

      },

      {

       "Name": "StorageLocation",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|StorageLocation",

       "Items": [

        {

         "Timestamp": "2023-10-22T22:00:00Z",

         "Value": null,

         "Good": false,

         "Errors": [

          {

           "FieldName": "Value",

           "Message": [

            "The configured data reference for 'Attribute 'StorageLocation' in Element 'Equipment1' in Element 'Asset1'' does not support filter expressions."

           ]

          }

         ]

        }

       ]

      },

      {

       "Name": "ProductCode(SICC)",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|ProductCode(SICC)",

       "Items": [

        {

         "Timestamp": "2023-10-22T22:00:00Z",

         "Value": null,

         "Good": false,

         "Errors": [

          {

           "FieldName": "Value",

           "Message": [

            "The configured data reference for 'Attribute 'ProductCode(SICC)' in Element 'Equipment1' in Element 'Asset1'' does not support filter expressions."

           ]

          }

         ]

        }

       ]

      },

      {

       "Name": "Plant",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|Plant",

       "Items": [

        {

         "Timestamp": "2023-10-22T22:00:00Z",

         "Value": null,

         "Good": false,

         "Errors": [

          {

           "FieldName": "Value",

           "Message": [

            "The configured data reference for 'Attribute 'Plant' in Element 'Equipment1' in Element 'Asset1'' does not support filter expressions."

           ]

          }

         ]

        }

       ]

      },

      {

       "Name": "MeasurementPoint",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|MeasurementPoint",

       "Items": [

        {

         "Timestamp": "2023-10-22T22:00:00Z",

         "Value": null,

         "Good": false,

         "Errors": [

          {

           "FieldName": "Value",

           "Message": [

            "The configured data reference for 'Attribute 'MeasurementPoint' in Element 'Equipment1' in Element 'Asset1'' does not support filter expressions."

           ]

          }

         ]

        }

       ]

      },

      {

       "Name": "Mass",

       "Path": "\\\\AFServer\\AFDatabase\\Equipment1|Mass",

       "Items": [

        {

         "Timestamp": "2023-10-22T22:00:00Z",

         "Value": null,

         "Good": false,

         "Errors": [

          {

           "FieldName": "Value",

           "Message": [

            "[-12301] Performance Equation parsing error"

           ]

          }

         ]

        }

       ]

      }

     ]

    }

  • Hi ​ ,

    Please try below where I changed the second question mark to an & sign.

    https://PIAFServer/piwebapi/streamsets/xxxxxxxxxx/interpolatedattimes?Time=t&timezone=Central%20European%20Standard%20Time&selectedFields=Items.Name;Items.Path;Items.Items.Timestamp;Items.Items.Value.Value;Items.Items.Good&filterExpression=BadVal(.)=True

  • Hi ​ ,

    I made a mistake in syntax for the 'Performance Equation parsing' error.

    Please try below instead. This will take care of the PE parsing error.

    Use &filterExpression=BadVal('.')=0, instead of &filterExpression=BadVal('.')=True

    As to the other errors, I can see that this error occurs for 'static' attributes that aren't tied to PI Point data references. How do you handle this error might be up to you...