3 Replies Latest reply on Jun 9, 2017 1:23 PM by pmartin

    Manual Data Entry In PI PB that shows up in AF and can be trended back in PB.

    DElliott

      So basically what I am trying to accomplish is to have 4 data points that can be selected in PB and changed to whatever the operator desires.

       

      The end result is simply to have historical trending options of these 4 points. I am not to skilled with VB code so I am trying to steer clear of it but I do feel as though there is a relatively simple method that can be setup through AF.

       

      Some help or advice would be appreciated.

        • Re: Manual Data Entry In PI PB that shows up in AF and can be trended back in PB.
          pmartin

          Hi Derek,

           

          You can absolutely write to PI Points from within ProcessBook but you will need to use VBA.  Fortunately, as you predicted, the code is not that complex.  If you have AF attributes configured using these points as their data reference, they will update automatically.  Here is the code:

              Dim newVal As Variant
              Dim server As PISDK.server
              Dim pipt As PISDK.PIPoint
              Dim tagsplit() As String
              Dim ptname As String
             
              newVal = InputBox("Enter new value for this tag")
              tagsplit = Split(ThisDisplay.Value1.GetTagName(1), "\")
              ptname = tagsplit(UBound(tagsplit))
          
              Set server = PISDK.Servers("your server name")
              Set pipt = server.PIPoints(ptname)
          
              pipt.Data.UpdateValue newVal, "*"
              ThisDisplay.Refresh
          

          Some caveats:

          1) You will want to stick this inside of a Sub that is tied to the click event for your value.  This can be done up on top of the VB editor by selecting the symbol and then selecting the Click action:

          2) Before this code can be run, you will need to add a reference to the PI SDK in the VB editor.  You can do this by going to Tools > References and adding the PISDK 1.3 Type Library.

          3) My code uses Value1.GetTagName(1) to get the name of the tag from the Value symbol configuration.  You could also hardcode in the tag name for each value by swapping out server.PIPoints(ptname) to server.PIPoints("your tag name")

           

           

          If you have any questions or trouble let me know!

          1 of 1 people found this helpful