I am trying to write a boolean value to a tag from a derived tag. I have may derived tag setup like this:
The READ expression is this: if(timeBetween({source}, "8:00:00 am", "8:00:30 am")|| timeBetween({source}, "8:00:00 pm", "8:00:30 pm"),true,false)
I think I need to use a script to write(on value change) the result to the tag that needs the value, the scritp is written like this: system.tag.writeBlocking("[~]BitWinders/BitWinder_1/LH/g_xHMI_ResetProductionData_1_.value") The script is not executing.
Should I use a script or the WRITE of the derived tag?
Hi @mjohnson0238, why are you using a derived tag in this case? The write expression will write back to the source tag path, which is [default]Time in your case. The purpose of a derived tag is to differentiate between what is read from the source tag path and what is written to it.
FYI, system.tag.writeBlocking() requires a list of tags and a list of values. For example:
if not initialChange:
if system.date.getHour24(currentValue.value) in (8,20):
system.tag.writeBlocking(['[default]Path/To/BooleanTag'],[True])
return
system.tag.writeBlocking('[default]Path/To/BooleanTag'],[False])