3 Replies Latest reply on Nov 5, 2009 7:49 PM by spilon

    Text as ProcessBook Object




      This time I want to write a code in VB Editor in ProcessBook to change the color of the text or manipulate the sentence of the test already existed in processbook display.


      Assume I have a value object in display and I add a text underneath and when a value gets update I want to change the text sentences or color.


      But I noticed that Text is not a processbook object and I cannot manipulate the properties.


      Can anybody tell me how I can change the properties or caption programaically?





        • Re: Text as ProcessBook Object
          Daniel Takara

          Hi Mohammad,


          You just need to right-click on the Text object in build mode and select the option "Enable Scripting".


          In case you haven't already done so, I would suggest you to go through the "PI Client Advanced ActiveX Scripting" training, available in vCampus. It describes not only this specific detail (and the reason why not all objets have scripting enabled by default) in the section "How to Make Static PI ProcessBook Objects Scriptable", but many other aspects in ProcessBook scripting in general.

          • Re: Text as ProcessBook Object

            Text is an object within the ProcessBook symbol Library (PBSymLib.Text). 
            You are looking to update the "Contents" property, not the Caption.

              • Re: Text as ProcessBook Object

                While both of Daniel's and Rhys' answers are absolutely correct, I would like to invite you to consider other, non-programmatic, ways of doing that. Both the PI Server and PI ProcessBook have features that are capable of doing something like this without a line of code.


                On the PI Server side, you might want to consider creating a Performance Equation (PE) point with a syntax equivalent to IF 'tag1' = 1 THEN "First Text String" ELSE IF 'tag1' = 2 THEN "Second Text String" ELSE "Third Text String". That way results are stored right in the PI archives and are available as is (i.e. the friendly text rather than the original numeric value) to users, including for Value symbols in PI ProcessBook. The big advantages of this is are that you don't have code to write/maintain and the values are readily available for other client applications and any calculation/analysis engine you may have.


                If you don't think it is worth storing that information server-side and you have a limited number of users/displays in need of that "number-to-text conversion", then you might want to consider creating a PI Calculation Data Set in PI ProcessBook. Just go Tools > Data Sets > New PI Calculation and use the same syntax as mentioned above. Then you can make use of client-side data set in symbols like Value or Trend (simply click the down array beside Tag Search and select PI Calcuation to grab your data set.


                If you are new to these concepts, I invite you to watch the appropriate chapters in the PI System Manager I: Essentials Skills and the PI ProcessBook, PI DataLink and PI WebParts online courses, available under the vCampus Training Center. Should you need more assistance on these "PI admin" and "end-users" tasks, I invite you to contact our technical support team. If you decide to go the VBA route, we'll be more than happy to support you on this forum


                Hope this helps!