I created with "data sets" an expression, however I can not associate the new data set to an object and / or macro with the possibility of true or false
Your code is fine, I think what is happening is that the circle is assigned to both layers. I have tested the code assigning the macro to the button and when I click on it the text "Layer 1 Visible" and "Layer 2 Visible" is hidden depending on the value. To assign a layer to an object you need to right click on it in build mode then select Assign Layers.
I assume you are trying to access your Dataset in VBA. Do you have some code you could share or provide a bit more information?
I'm not sure this answers your question but here's how to access your DS in VBA:
Dim MyEditDataset As Dataset
Set MyEditDataset = ThisDisplay.Datasets.GetDataSet("Your_dataset_name_here")
I have made an operation with two TAG (exactly this is a differrence of value) and I need to have a signal green if the difference is greater than 3 instead red if it is less.
Thanks for the precision about the Dataset, are you looking to change the color of an object in your PI ProcessBook Display? What is the signal you are talking about, a PI Value in a display? Why do you need it in VBA, it seems this can be covered directly by PI Processbook.
I have create a red circle and green circle. After that i have create a Layer 1 and layer 2 and red circle has layer 1 and green circle has layer 2.
The new Data Set has "value7" , the macro that I have create is:
Private Sub Display_DataUpdate()
Private Sub OS1_AIC()
Dim vrDate As Variant
Dim vrStatus As Variant
Dim MyValue As Variant
MyValue = Value7.GetValue(vrDate, vrStatus)
If IsNumeric(MyValue) Then
If MyValue > o = 3 Then
Me.Layers(2).Visible = True
Me.Layers(1).Visible = False
If MyValue < 3 Then
Me.Layers(1).Visible = True
Me.Layers(2).Visible = False
But the macro doesn't work good both circle aren't visible.
I will look into your code and try to replicate the issue. In the meantime, here's what I was talking about ProcessBook having a builtin function called multistate symbol that change automatically the color of a circle depending of it's value. This is why I was asking for more information.
Retrieving data ...