1 Reply Latest reply on Sep 10, 2018 7:42 PM by rschmitz

    When using the GetElements controller, how do I exclude items based on "templateName"?

    cageybee

      If I have some elements that have a template name "ElementX", how do I specify in the URL to exclude this element? I tried

       

      elements/{webId}/elements?searchFullHierarchy=true&templateName<>ElementX

       

      and

       

      elements/{webId}/elements?searchFullHierarchy=true&templateName!=ElementX

       

      and few other combinations and I can't seem to make it work.

       

      Thanks.

        • Re: When using the GetElements controller, how do I exclude items based on "templateName"?
          rschmitz

          Hey Ramin,

           

          It looks like from the documentation what you want is ":<>" for the not equal operation. Though I think what you're trying to do is syntactically invalid. If you're looking to do an Element Search the URL would look closer to the following

           

          piwebapi/elements/search?dataBaseWebId=DATABASE_WEBID&query=templateName:=Boiler

           

          That being said, I tried this out on my own system and would appear that you are not allowed to use the NOT operator for this type of query ("Invalid comparison operator '<>' for search criteria 'TemplateName'").

           

          Cheers,

          Rob

          1 of 1 people found this helpful