1 Reply Latest reply on Aug 25, 2014 10:34 AM by Gregor

    Limit a Tag Search Count in GetPoints

    MaxStrueverWipro

      Hi

       

      I have an app that allows users to search for tags. However, sometimes they perform searches which unintentionally return tons of tags very slowly, or even times out (web app).

       

      as part of the WhereClause, is there something I could add to the query to limit the tag search to only return the first 50 tags? for 99% of the user's searches, they will not need more than the first 50 tags for this app. this would speed up most searches and give users an option to return the full search if they really needed. in real SQL this is accomplished by the TOP ## parameter. I think this might be called 'paging'

       

      for example

       

       

       
      myPIServer.GetPoints("tag = '" + userinputText + "'");
      //is there a clause like this to bluntly limit the number of returned tags:
      myPIServer.GetPoints("tag = '" + userinputText + "' AND count < 10");
      //or
      myPIServer.GetPoints("tag = '" + userinputText + "' AND Limit 40");
      

       

        • Re: Limit a Tag Search Count in GetPoints

          Hello Max,

           

          Please see Enhancement Request 20988OSI8 - Implement a RowCount option for GetPoints. There are a few options I see:

           

          1. Use GetPoints asynchronously. This allows to cancel the operation when it takes too long.

           

          a) Offer a control to users that allows them to cancel long running queries
          b) Use a timer and cancel the query when the OnTimer event occurs

           

          2. Use the Tag Search dialog that comes with PI SDK. It operates asynchronously and offers a cancel button.

           

          3. Do some basic checks on the WhereClause before executing GetPoints to avoid common user errors.

           

          4. A common way to group tags is the Point source. Depending on the point sources used in your PI System, you may be able to create a list of "valid" point sources and break the users query into several queries that use the list of "valid" point sources.

           

          5. Set the timeout of your connection to e.g. 10 seconds before executing GetPoints and set it back to its previous (default) afterwards.