Tag group updating all values

I have some tags which have a script to change the Tag Group at a certain time. This tag group is set to 0ms so that it will stop reading data. I did this to keep a static value at a certain time. I have a list of tags 5am-6am, 6am-7am ect... but Im not sure why when the tag group updates it also updates the tag value. I don't want it to update once it is at the static value of it designated time.

While i don't have an answer as to why your group is behaving that way, what i would do to achieve what seems to be your goal is:

  1. Create a folder with all of your opc tags within and another folder with the same tag names but memory as the Value Source.

  2. Create memory or expression tags that will function as your trigger(s) to check whether it's time to update the memory tag.

  3. Add this script to every opc tag so that your memory tags are only updated at the correct time.

	tagName = tag.name 
	#Use the same tag name so it's easier to copy the script
	
	TriggerOK = system.tag.readBlocking(["[.]" + tagName + "TriggerUpdate"])[0].value 
	#Check if the trigger is ok to update
	
	if TriggerOK and not initialChange:
		paths = ["[.]../MemoryTags/"+ tagName]
		values = [currentValue.value]
		system.tag.writeBlocking(paths, values)
		#Write to the memory tag only if the trigger is ok

I believe you should be using driven tag groups instead of direct tag groups. You'll probably have to make one for every hour or whatever condition you're needing different, but would simplify it greatly.

If these are all reading from the same PLC tag, I would suspect that because the value via OPC updates, all associated tags are probably updating even if the tag group isn't polling for an update, but I could be wrong.

Sounds like an XY problem where you may be trying to solve the problem in the wrong way.
Go back a step; whats the problem you're trying to solve?

1 Like

Yeah, it looks like they have a tag already with the running total, so probably easiest to set up a gateway scheduled script to run once an hour and write these values to an integer array memory tag with a size of 24 based on the start of each hour. I would guess end goal is a number of parts per hour but could be wrong.