AnsweredAssumed Answered

how to change an attribute value for only one element of interest in processbook after a button click ?

Question asked by Ahouassou on Jul 24, 2019
Latest reply on Jul 30, 2019 by gregor

Hello everyone ! I have a processBook display based on Three elements of interest (represents engines), as you can see in the following picture.

Some Details :

- These three elements are identical (come from the same element template).

- I've programmed a button (in VBA) which reverses the value of an attribute specific to these elements (this attribute can take "Oui" or "Non" value) as you can see in this picture.



- If its value is "Non" then after clicking on test button, value = "Oui" (and vice versa)


now, Here is my main problem : When I click on the button, the value changes correctly for the current element. But it changes also for the two others elements !

I wish it could just change for the current element, not for the others ones.


Can someone help me to fix this problem ?

Here is my current code :


Sub En_maintenance()

Dim PIServer As PISDK.Server

'Definition des variables de points

Dim Pt_Em_A As PIPoint

Dim Pt_Em_B As PIPoint

Dim Pt_Em_C As PIPoint


'Affectation des variables aux points

Set PIServer = PISDK.Servers.DefaultServer

Set Pt_Em_A = PIServer.PIPoints("WipA.En maintenance")

Set Pt_Em_B = PIServer.PIPoints("WipB.En maintenance")

Set Pt_Em_C = PIServer.PIPoints("WipC.En maintenance")



If Pt_Em_A.Data.Snapshot.Value = "Non" Then

    Pt_Em_A.Data.UpdateValue "Oui", Now()


   Pt_Em_A.Data.UpdateValue "Non", Now()

End If



If Pt_Em_B.Data.Snapshot.Value = "Non" Then

   Pt_Em_B.Data.UpdateValue "Oui", Now()


  Pt_Em_B.Data.UpdateValue "Non", Now()

End If



If Pt_Em_C.Data.Snapshot.Value = "Non" Then

   Pt_Em_C.Data.UpdateValue "Oui", Now()


   Pt_Em_C.Data.UpdateValue "Non", Now()

End If

End Sub



Kind regards !