Device Update Node, Setting Device Tag with "" Deletes Tag from Device

I have a workflow that sets device tags with data passed into the workflow from a dashboard input control button. If I pass-in data as shown below, the ch3type tag is not set to “”, it is deleted from the device. Is the normal/expected operation?

Device update set device tag parameters:

Key Template: ch3type
Value Template: {{data.type}}

Data that is passed into the workflow:

“calSlope”:“0.005882353”
“calOffset”:“795”
“max”:“15”
“min”:“0”
“type”:""
“eu”:“inWC”
“name”:“Differential Pressure”
“channel”:3
“deviceId”:“8944538523020626860”

1 Like

Hi @Edward_Cline,

I was able to replicate this, and have confirmed this is intentional behavior. Just as you described, when I set my tag value as {{data.type}} in the Device: Update Node, the tag is removed if it existed previously. However, when I explicitly include "" as the value of the tag, I get the expected result on the device page: ch3type="".

The key difference between these two configurations is that the explicit ("") quotes are of type string, and the value is a string containing two quotes, while the payload value that must be referenced with {{data.type}} is an empty string. When a tag is set to a blank, null, or undefined string, the workflow will treat this as a tag removal, as the tag is now empty.

If you would like to reference the payload value, the value would need to be formed as "value":"\"\"", or you could set the string value explicitly using a Mutate Node. Here is an example of logic that reformats the string:

Please let me know if I can assist further!
Julia

Thanks for the quick reply Julia!

I stumbled across this through use of a dropdown selector for the ‘type’ value on my user input form. When created it includes a (no value) state which I had set as the default. The no value state of a dropdown is represented by “”, which when sent into my workflow caused the tag to be deleted. Good to know. I will modify the workflow to check for this to prevent the tag from being deleted in the future.

1 Like