5 Replies Latest reply on Sep 21, 2017 2:03 PM by David Hearn

    AF Element Search By Extended Property



      The AFElement.FindElementsByExtendedProperty Method does not support search of String Array Type Property.


      Please find below the Remarks from the help file

      "This method will find the elements that have an extended property with the specified propertyName and its value set to one of  the values in the list of specified values. All extended property values of type String and Guid on an AFElement are automatically indexed in theserver to speed up the search on these types of property values. These are the only type of property values that can be searched. The QueryDate of the specified database will be used to determine the collection of elements that are returned from this method. "


      Is there any other way to Search ?


      Thanks in advance



        • Re: AF Element Search By Extended Property
          Rick Davin

          Hello Abdul,


          Can you share the code you are using?  Are you passing anything into the values parameter, or is it null?  


          If you read the very top of the LiveLibrary help for AFElement.FindElementsByExtendedProperty, you will also see:


          Retrieves a list of AFElement objects that have the specified extended property string values defined for the element.


          The way I interpret this is that the search is precisely on string values and not String Array values.  The values parameter is an IEnumerable<string>, where each item is a scalar value.  For example, an individual scalare value of "abc" is far different from an item in array, such as { "abc" }.  There is very little out-of-the-box support for arrays.  You will have to create a custom workaround.  My suggestion is to pass values of null and only search on propertyName.  Your code will then have to additionally filter the returned elements on the desired array values.

            • Re: AF Element Search By Extended Property
              David Hearn

              Rick is correct, only Guid and String values are supported when searching by extended property (not arrays of Guids or strings). The search will return a match if one of the values specified in the FindElementsByExtendedProperty call match the value of the extended property.


              Also, passing a null for the values parameter also will not work as the search will do an exact match of the extended property value. Adding support for searching an extended property with wild cards could be a possibility in the future, but searching for a string value within an array is not very likely because of the difficulty of implementing with good performance.