3 Replies Latest reply on Jul 3, 2012 1:09 PM by mhamel

    Show AF Attribute in ProcessBook Display




      We would like to show the AF attribute in ProcessBook display.  Is it possible to do it with VBA or Add-in?  If so, would you provide a code example?





        • Re: Show AF Attribute in ProcessBook Display
          Ahmad Fattahi



          I am assuming you are already aware of the Element Relative Displays that are already available in PI ProcessBook out of the box. In case you need to do more and access AF SDK within PI ProcessBook VBA, please take a look at the example called "AF Wrapper for PI ProcessBook" in vCampus Download Center (choose Extras from the drop down).

          1 of 1 people found this helpful
            • Re: Show AF Attribute in ProcessBook Display

              Thanks for your reply.  I appreciate.


              We are using AF2 for most of our displays just because they are different in nature.  I checked AF Wrapper and I can get the attribute description.  How can I manipulate the trend's traces to show the description in the trend?





                • Re: Show AF Attribute in ProcessBook Display

                  @Aimin: You can show or hide the trace's description by using the code snippet as shown below.

                  Dim CurrentProp As PBSymLib.TrendFormat
                  Set CurrentProp = Trend1.GetFormat
                  CurrentProp.ShowDescription = True
                  Call Trend1.SetFormat(CurrentProp)

                  The description of AF attribute cannot be displayed in Trend symbol of PI ProcessBook. You cannot manipulate it manually too.


                  You can enhance the AFWrapper library to add a GetAttributeDescription method that you can invoke from PI ProcessBook. This method could look like the following:

                  // Gets an attribute description for a given element + attribute path
                  public string GetAttributeDescription(string fullAttributePath)
                       AFAttribute attribute = GetAttribute(fullAttributePath);
                       if (attribute != null && attribute.Description != null) return attribute.Description;
                       else return "";

                  It becomes simple to invoke the aforementioned method from a ToolTipText event. I have attached to this post an example on how I have proceeded.