Write tag value to new Memory Tag

I'm trying to take a value of an OPC Integer Tag we will call A and write it to a new Memory Tag we will call B. Is this accomplished by using a Value Changed script so when the value of Tag A changes it will execute the script, writing the value of Tag A to B?

I dont think this is correct, but its a start. If im on the right path here, does anything need to be added? If not, how would I go about accomplishing this?

Test = system.tag.read('A').value
system.tag.write('B', Test)

Thank you.

A value changed script is one way to accomplish this, yes. There's no need to read A; the value changed script will have a currentValue parameter already supplied.

Makes sense, how does the syntax for currentValue() go?

If I want to write currentValue to Tag B?


system.tag.writeBlocking(["path/to/B"], [currentValue.value])

Thank you. If i wanted to only write to the memory tag at a certain time, say whatever the value of the tag is at 6am, how would this be achieved? The tag value im writing to the memory tag is reset at a certain time daily and i dont want it to write 0 to the memory tag. I need it to write the maximum value achieved before reset.

Good morning Kaleb,

I recently set up some gateway scripts that do this exact thing, write to other tags every 15 minutes of the hour. You can create a gateway script under "Scheduled" that will trigger at exactly 6 am if that's what you're looking for. You can accomplish this with the following script on a gateway scheduled script set for 6 AM:

pathToTagA = (insert path here)
pathToTagB = (insert path here)
tagAValue = system.tag.readBlocking(pathToTagA)
system.tag.writeBlocking(pathToTagB, tagAValue)
1 Like

Thank you sir. I did end up playing around until I figured it out. I appreciate your reply.

1 Like

Glad you got it figured out!

1 Like