Hi everyone,
I’m using the MQTT Engine module in Ignition to subscribe to a topic that delivers JSON-formatted payloads. The engine correctly creates tag structures from the incoming data, including arrays.
However, I’m running into an issue:
When the length of an array in the JSON payload decreases (e.g., from 3 elements to 2), the tags corresponding to the removed elements are not deleted. They remain in the tag tree with outdated values.
For example:
// Initial payload
{
"operations": [
{
"bom": [
{"materialId": 1},
{"materialId": 2},
{"materialId": 3}
]
}
]
}
Then later:
// Updated payload
{
"operations": [
{
"bom": [
{"materialId": 1},
{"materialId": 2}
]
}
]
}
After this second payload, the tags under:
[MQTT Engine]devices/device1/operations/0/bom/2/materialId
still exist, even though that array element no longer exists in the new message.
Is there a built-in way for MQTT Engine to automatically remove obsolete tags when the array shrinks?
If not, how do you handle this scenario? Should I script a cleanup process using Gateway Timer Scripts or Tag Change Scripts?
Any advice or examples would be greatly appreciated!
Thanks in advance.