System.tag.writeblocking vs system.tag.configure

I have the need to modify tag properties via scripting (override UDT definition), I have noticed that I can do it 2 different ways, one with system.tag.writeblocking and also with system.tag.configure.

For example, I want to change a tag to be expresion type and set the expression, I can use any of the options below.


tag = {
            "name": "Valve_Open_DI",           
            "valueSource": "expr",
			"expression": "{[.]Close_Valve_DO}"
system.tag.configure("[default]TestValve", [tag], "o")


system.tag.writeBlocking("[default]TestValve/Valve_Open_DI.valueSource", "expr")
system.tag.writeBlocking("[default]TestValve/Valve_Open_DI.expression", "{[.]Close_Valve_DO}")

Is there any advantage or disadvantage between them?

Would the answer be different if I apply this to the UDT itself ("[default]types/SomeUDT")

Thanks in advance!

As a rule of thumb:

  • If you have one property to change, just use a write.
  • If you have more than one property (or tag!) to change, and/or you want "atomicity" of your configuration change, use configure.

Ultimately, it goes through basically the same mechanism; the write will create a configuration change and apply it using the same mechanism. But it's a bit easier to set up (I would argue) a write for a simple property change, if you know for a fact it's going to be an overwrite and there's no need for the extra functionality configure gives you.