Hi all,
Currently delving into Wonderware/Aveva System Platform for the first time, and I'm trying to set up a script to automatically write to the object description.
I have a template called, say, $Tank. $Tank has an attribute Number (integer).
I also have templates called $Motor, $Valve and $Sensor
I created derived templates of $Motor, $Valve and $Sensor and dragged them into the $Tank template. Inside the $Tank template I renamed them to Agitator, InletValve and LevelSensor.
Then I add a script to the $Tank template that executes on a Me.Number data change. I have confirmed that the script is executing as expected.
In the script, I have:
Then I create 100 instances of the $Tank template, update the Number attribute in all of them, and I would expect the ShortDesc attribute of each motor, valve and sensor to be updated to "Tank x Agitator/Inlet Valve/Level Sensor", but it does not work.
Using the same script to write instead to another user-created attribute, e.g.
...works just fine, but it seems to have no effect when writing to the ShortDesc attribute. Even just trying to write a simple script that writes "Testing" to the ShortDesc attribute doesn't seem to work.
Is there something wrong with my script? Is the ShortDesc parameter not editable by a script? Is there another way to achieve my outcome short of manually opening 100 instances of each device and manually typing it in?
I posted this on the Wonderware technical support forums and got crickets, hopefully PLCs.Net can help me out again!
Currently delving into Wonderware/Aveva System Platform for the first time, and I'm trying to set up a script to automatically write to the object description.
I have a template called, say, $Tank. $Tank has an attribute Number (integer).
I also have templates called $Motor, $Valve and $Sensor
I created derived templates of $Motor, $Valve and $Sensor and dragged them into the $Tank template. Inside the $Tank template I renamed them to Agitator, InletValve and LevelSensor.
Then I add a script to the $Tank template that executes on a Me.Number data change. I have confirmed that the script is executing as expected.
In the script, I have:
Code:
Me.Agitator.ShortDesc = "Tank " + StringFromIntg(Me.Number, 10) + " Agitator";
Me.InletValve.ShortDesc = "Tank " + StringFromIntg(Me.Number, 10) + " Inlet Valve";
Me.LevelSensor.ShortDesc = "Tank " + StringFromIntg(Me.Number, 10) + " Level Sensor";
Using the same script to write instead to another user-created attribute, e.g.
Code:
Me.Agitator.MyStringAttribute = "Tank " + StringFromIntg(Me.Number, 10) + " Agitator";
Is there something wrong with my script? Is the ShortDesc parameter not editable by a script? Is there another way to achieve my outcome short of manually opening 100 instances of each device and manually typing it in?
I posted this on the Wonderware technical support forums and got crickets, hopefully PLCs.Net can help me out again!
Last edited: