Is there a method that updates values of AF attributes (AFAttributeList) instead of updating each attribute separately? and why FindAttributesByPath takes too much time while database parameter in the method is null

I am using att.Data.UpdataValue to update each attribute seperatly.
image.png.png
In this snippet of code, the method "FindAttributesByPath" takes too much time to respond . While when I change its parameter of Afdatabase from null to database, it responds so fast. I'm not identifying the AfDatabase in the method, because the attributePaths have different DataBases.

 

Is there any solution ?

Thank you.

 

  • I would suggest you also tag this post with "AF SDK".

     

    Question 1) Can you perform a bulk update for many AFAttribute items?

    Answer: YES. You will need to call an AFAttributeList object, and grab its Data property, which is really an AFListData object that has an UpdateValues overload. CRITICAL: you must be sure that each AFValue.Attribute is correctly set. In your case, this means that item.Value is an AFValue with a .Attribute property set to att.

     

    Question 2) Why does FindAttributesByPath take so much time when AFObject relativeFrom is null?

    Answer: First off, note that relativeFrom does NOT have to be an AFDatabase. It could be an AFElement, though there are far more efficient searches for AFElement than an AFDatabase.

    The question on performance really depends upon so many factors such as (1) how many paths are you specifying, (2) how many elements are in your database, and (3) how many attributes are on each element. In order to satisfy the call, it requires a full load of all your elements.

    If you can share more about the general size and shape of your database and how many paths are specified across how many elements, it could help to refine this answer.

    If you can cache the AFAttribute.ID as a part of your StructuredWriteItem class, it could help to make your searches much faster.