Writing tag status to tag from derived tag

I am trying to write a boolean value to a tag from a derived tag. I have may derived tag setup like this:
image

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:

system.tag.writeBlocking(["myTag1", "myTag2"], [val1, val2])
1 Like

A coworker of mine suggested it, using the derived tag. On my time tag could i set up a script to execute a write to a boolean at 8am and 8pm?

You can.

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])
1 Like

You certainly can as @lrose suggested :slightly_smiling_face:.

However, depending on what version you’re running, you can do via a scheduled gateway event script: Gateway Event Scripts - Ignition User Manual 8.1 - Ignition Documentation