AnsweredAssumed Answered

FindElementAttributes does not search only searchRoot

Question asked by Ståle Nestås on May 24, 2016
Latest reply on May 26, 2016 by Ståle Nestås

Hello,

I am using AFAttribute.FindElementAttributes Method to get the immediate attributes under an Element. I am seemingly also getting the AFAttributes under the first children elements, event though I have set searchFullHierarchy to false.

 

 

var pointAttributes = AFAttribute.FindElementAttributes(element.Database, element, "", "", null, null, AFElementType.Any, "", "", null, TypeCode.Double, false, AFSortField.Name, AFSortOrder.Descending, 0, int.MaxValue, out totalFound);

 

For the string searchFilters I have used an empty string, as the documentation says that it should match all. I have also tried null and "*" with the same result.

 

My test AFDB has three levels.

Elem1 ( Attribute1)

     - Elem2 (Attribute2)

     - Elem3 (Attribute3)

          - Elem4 (Attribute4)

 

With the searchRoot set to Elem1:

If I set searchFullHiearchy to false, I get Attribute1,Attribute2 and Attribute3.

If I set it to true, I get all 4.

 

AFSDK 2.8.0.744

AFServer either 2.7.5.7166 or 2.8.0.744

 

I would like to only return Attribute1.

What should the correct parameters be?

 

I'd also like to only return PIPoint attributes by changing AFElementType.Any for AFElementType.PIPoint. I would assume this search will be faster than iterating the element.Attributes ?

 

Thanks

Outcomes