WinCC Confirm the input value of process tag with a button

This is my firts example that I have writed with english language, I know that you will saw a lot of mistake, if you want to help me to fixed, please, write me and tell me.

This is the answer from a question of siemens forum, where the goal is before changing a process value tag we must confirm it with an Ok button! There are several ways to do it, but I have proposed the following.

First of all, we are going to consider that the tags that we want to confirm are the following (TagName1, TagName2 ...) you must use the tag of your project

We only need created an internal tag of the type String (Text tag 8-bit character set)

This is the screen of our example, where we have a lot of Input/Output fields, all of them are linked with his tags, but we have changed one of his properties. The field type must be Output.

 

This is very important for our example, All the objects have the same name of his linked tag

 

Every object have the same event if we have followed the above step . So we can copy and paste to all of them.

There is another way to do it, we can create a new macro with VBA and run it.

 

If we donĀ“t have the name of the object like the name of the tag, we can declare a constant and assign the name of the tag.

There are two possibility, the easiest is the first, because that way we avoid making mistakes.

We have an picture window , and we make it visible, the second step. Once we have it visible, we can access to his objects, and now we are going to transfer the current value to another object called ActualValue.

Finally we are going to save the name of the item.ObjectName to the internal tag. For that reason, this code is the same in all the objects

The previous picture window has a pdl, with two objects (input / output fields).

The first object ActualValue has the propertie field type to output.

The NewValue object has the propertie field type to input/output , which will be where we are going to write the value of process that we want to assign.

The following code is assigned in the Output Value property in VBScript for both objects.

OutputValue_Trigger = item.ImputValue

That means, that any value that we introduce is the same value that we are going to show, the trigger for this property, is the window cycle.

 

And finally the button to confirm, the Ok button, what we do is to transfer the value that we have entered in the NewValue object, to the tag that we have saved in the internal tag, once the value has been transferred, we close the picture window. The cancel button close the picture window without transferring the value

 

If you want to see a videoYou Tube.

 

08 de Marzo del 2018

"La gratitud en silencio no sirve a nadie". Gladys Bronwyn Stern