Dag Reppen

Capture updated AF Values from Processbook VBA

Discussion created by Dag Reppen on Oct 3, 2013



I have written a few macros for one of our processbook displays that read in AF values from our AF Database, performs a calculation, and then manipulates the display based on the results (highlights a trend, changes the current context, etc.). When I initially created the macros it appeared that they worked just fine. To test some of the triggering events I manually changed one of the values in our AF database via System Explorer. The "trend" and "value" objects that referenced that attribute updated immediately. However, the macros did not recognize the update and continued to use the old value.


After many unsuccessful attempts to obtain the correct data I decided to take a hiatus and move to a different project involving creating a C# application using AF and AN SDK. Sure enough I encountered the same type of issue. This time, however, after perusing vCampus I found some useful information. The AF values that referenced PI tags would update just fine as they are dynamic. If I were to manually change a value in System Explorer it would be a static value. To resolve this required the simple use of Database.Refresh(). Upon finding this information I thought I had got two birds with one stone and attempted to solve my original issue. Unfortunately, I have thus been unsuccessful in finding a VBA (with AF Wrapper) code equivalent to Datebase.Refresh, and was hoping one of you might have the solution!