2 Replies Latest reply on Apr 3, 2017 3:05 PM by FDefonseca

    Processbook AF2 value with VBA




      I'm building a processbook that permit me to visualise values from AF2 dataset.

      That for, I'm using the value object of processbook pointing om AF attribute trough AF2 source.


      As the attribute path is coming from another application, I set the "Tag name" with VBA code wich works pretty well:


           value_Age = "AF2." + List_TFO(1) + "|Age"

           Age.SetTagName (value_Age)


      The problem is that in some case, the data source of the value object is automaticaly setted back from AF2 to the default PItag search.


      Is it possible in VBA to set and force the data source to AF2 with the good AF server reference?


      Best regards,

        • Re: Processbook AF2 value with VBA

          OK.  So tag name recognition is kind of complicated in PI ProcessBook because users have named pi tags all sorts of things over the years.  The "Tag" field could be a PI tag, it could be a dataset reference, it could be a context reference, or it could be a custom dataset (it turns out that AF2 is a custom dataset, it's just one we wrote).


          I don't remember the exact logic it uses off the top of my head, but it starts with the more complicated cases and ends with the simplest one (pi tag).  In general, if it has a "." in the name, it checks the handler that is before the "." to see if it is a legal reference.  If not, it checks to see if it's a pi tag.  This is because you can have pi tags with "."s in them (older versions of PB would assume it was a dataset and not find the tag).  Once PB determines the type of the tag, it sets Symbol.TagInfoType, which you can check to see what type it found.  You can also use Symbol.SetTagNameWithTagInfoType("tagname", pbDataSet) in order to constrict the search to a specific type when you are setting it.


          However, in this case, "AF2.|Age" isn't a valid AF2 data reference (the AF2 add-in considers it a valid reference if it at least starts with "AF2.\\afserver\database".  Since in this case it doesn't, it checks to see if it's a pi tag.  That will fail too, so it leaves the TagInfoType as pbUndetermined, which is why it's defaulting to the "Tag Search ..." option.

          1 of 1 people found this helpful