VBA Code to update a tag to show red when the value is below zero (0) and stale or frozen values 'Red' and Green when values are greater than zero in a PI Processbook
Could you try using the Multistate Functionality of Processbook to achieve the same.
if that does not work, here is the code that will iterate to all value symbols in the display and change the linecolor according to the condition.
Private Sub Display_DataUpdate()
Dim sym As Symbol
For Each sym In ThisDisplay.Symbols
If sym.Type = 7 Then
If sym.GetValue("*", "Good") > 0 Then
sym.LineColor = pbGreen
sym.LineColor = pbRed
Can we use 'sinusoid' tag as a case study. how about stale or frozen values?
You can use "Sinusoid" for this.
As far as stale or frozen is concern ,i believe it depends on the scan frequency of a particular tag.
This can be implemented case by case basis for example some tags in the display.
Where will the PI Tag be in the VBA code?
No need of a PI Tag to be written in the code. You just need to add the Pi Tag on to the Display.
Here is the Files as requested.
To add to what Akash is saying about creating a multi state symbol, I believe watching this video may help:
OSIsoft: Create a Multi-State Object v3.2 - YouTube
Hope this helps!
Thanks Naik & Patrice.
for sharing and the support
Thanks & Regards
Retrieving data ...