3 Replies Latest reply on Oct 25, 2017 1:52 PM by pmartin

    get eventframes with custom filter (and multiple)

    cymerman

      Hi, i want to know how could i filter eventframes by custom filter and by multiple conditions

       

      i see that i could filter eventframes by name tag:

       

      https://b098-pi-monitoring.roche.com/piwebapi/help/controllers/assetdatabase/actions/geteventframes

       

      ?nameFilter=example

       

      but there is possibility to filter event frames by e.g. description and name in same time?

       

      or i need to add everything i want to filter to Attributes and use:

       

      https://b098-pi-monitoring.roche.com/piwebapi/help/controllers/eventframe/actions/createsearchbyattribute ??

        • Re: get eventframes with custom filter (and multiple)
          pmartin

          Hi Tomasz,

           

          Without creating attributes, I can't think of a way to do this in a single request without using the batch controller. In my batch request below, I search for something with the template "SaveTheDate" in the first request and then filter it by description in the second request.  The description I'm looking for is "Quick".  Here's the JSON:

           

          {
            "0":{
            "Method": "GET",
              "Resource": "https://<server>/piwebapi/assetdatabases/<assetdb webid>/eventframes?templateName=SaveTheDate&startTime=*&searchMode=BackwardFromStartTime",
            },
            "1": {
              "Method": "GET",
              "ParentIds": [
                "0"
              ],
             "RequestTemplate":{
                "Resource": "https://<server>/piwebapi/eventframes/{0}",
              },
             "Parameters":[
                "$.0.Content.Items[?(@.Description=='Quick')].WebId"
              ]
            }
          }
          
          1 of 1 people found this helpful
            • Re: get eventframes with custom filter (and multiple)
              cymerman

              Yeah, i see that could work but i see some restrictions...

              main problem i see here i amount of data that will be returned in request 0, maxCount I could set in request is 150000, but when i would have more data in response i would have not full data to filter

               

              I know that i could get next data, filter it and add to my response on view (something like lazy loading), but it could me more confused for user than getting data from one response

               

              second thing im thinking about is condition in that parametr, there is passibility to change equal to like? i tried to use wildcard sign as in Query String but of course it didnt work. It would be great to filter by part of text. There is some articule what conditions i could use here?

               

              Next restriction i have here is that user could filter by range of time eg. startTime > 1/1/2017