5 Replies Latest reply on Oct 23, 2017 9:18 AM by jason.hurst

    Search for custom property with exact match

    jason.hurst

      Hi everyone on Thwack,

       

      What I would like to do is have a search that doesn't return "results like" but only return items that exactly match the criteria I am looking for.

       

      We have a custom property called "Number" which is the number of the physical branch location.

       

      So when I am searching for physical location 53, I don't want results from physical location 953.

       

      I've looked for answers on Thwack and Google and couldn't find how to do this.

       

      Any suggestions?

       

      Jason

        • Re: Search for custom property with exact match
          d09h

          Which type of custom property is it?

           

          I'm speculating that if text, it may need to be integer or vice versa:

           

          Select the Format for the property.

          We recommend that you limit the string length for text properties. The string length can affect SQL performance, especially when custom properties are used in limitations. The shorter the string length, the faster the queries.

          To limit the string length, click Edit, and provide the maximum number of characters.

            • Re: Search for custom property with exact match
              jason.hurst

              It is an integer number, but I also tested this on a custom property that is text and got similar results. "State" to find "C" returned "CA" and "CT"

               

              I am guessing that the information is used in a SQL query using LIKE instead of EQUALS, hence the results.

               

              BTW, this is using the Search Nodes view / widget.

               

              Jason

                • Re: Search for custom property with exact match
                  jason.hurst

                  Ok, I just created a custom SWQL query that works for what I wanted.

                   

                  SELECT TOP 20

                  ' ' AS Status,

                  N.Caption AS Node,

                  '/Orion/images/StatusIcons/small-' + ToString(n.StatusIcon) AS [_IconFor_Status], 

                  '/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N%3a' + ToString(n.NodeID) AS [_LinkFor_Node], 

                  N.CustomProperties.Number

                  FROM Orion.Nodes N

                  ORDER BY N.CustomProperties.Number

                   

                  And that worked just the way I want, now I just need to figure out how to submit the search string through the URL

                   

                  Jason

              • Re: Search for custom property with exact match
                Mark Roberts

                May I suggest you use the Custom Query widget (previously called resources), which provides the ability to have a widget on a page that will list devices (and other useful information you may wish to include) in the listed output and provide the option to include a live search method. In your above example, add the Custom Query widget to a page, edit it and in the top window you would use your query (you can also take out the TOP too, as pagination will take care of this).

                 

                SELECT TOP 20

                ' ' AS Status,

                N.Caption AS Node,

                '/Orion/images/StatusIcons/small-' + ToString(n.StatusIcon) AS [_IconFor_Status],

                '/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N%3a' + ToString(n.NodeID) AS [_LinkFor_Node],

                N.CustomProperties.Number

                FROM Orion.Nodes N

                WHERE N.CustomProperties.Number = '${SEARCH_STRING}'

                ORDER BY N.CustomProperties.Number

                 

                Mark