# System.tag.write not writing all tags

**URL:** <https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [August 28, 2025, 2:39pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243 "2025-08-28T14:39:01Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![diego.marques](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/diego.marques/32/79285_2.png) [@diego.marques](https://forum.inductiveautomation.com/u/diego.marques)\
**Post date:** [August 28, 2025, 2:39pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/1 "2025-08-28T14:39:01Z")

</div>

I’m trying to write 14 tags with a script in a button `actionperformed` event:

```python
root = system.gui.getParentWindow(event).rootContainer

preset1 = root.getComponent('1L').intValue
tag1 = str(root.Dados.Meta.TagPath+"/something")
...
preset14...
tag14...

```

```python
preset_values = ([preset1],...[preset14])
tag_paths = ([tag1],,...[tag14])
system.tag.writeAsync(tag_paths,preset_values)

```

but only the last two tags are being sent to my PLC. These tags are referenced to a custom property of a UDTProperty type in my screen, that points to UDT Tag with derived type and the source tag path is like

```python
[MQTT Engine]Edge Nodes/{AreaName}/{TAG}/PI0{Index}/PropertyN_{TAG}

```

I’m using Cirrus Link MQTT Engine module to my PLC.

If I try to write one by one of the 14 tags and put a sleep() in between `system.tag.writeAsync(tag_paths,preset_values)` 14 calls, it works, but I know that sleep() is not welcome. How can I get my 14 tags successfully written?

any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 28, 2025, 2:42pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/2 "2025-08-28T14:42:05Z")

</div>

> [@diego.marques](#):
>
> ```python
> preset_values = ([preset1],...[preset14])
> tag_paths = ([tag1],,...[tag14])
> 
> ```

You've created tuples of single-element lists with this construct.

Should be like:

```python
preset_values = [preset1,...preset14]
tag_paths = [tag1,,...tag14]

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 28, 2025, 2:50pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/3 "2025-08-28T14:50:10Z")

</div>

As an aside...

### Bad

```python
root = system.gui.getParentWindow(event).rootContainer

preset1 = root.getComponent('1L').intValue
tag1 = str(root.Dados.Meta.TagPath+"/something")
...
preset14...
tag14...

preset_values = [preset1,...preset14]
tag_paths = [tag1,...tag14]
system.tag.writeAsync(tag_paths,preset_values)

```

### Better

```python
root = system.gui.getParentWindow(event).rootContainer

values = []
tags = []

values.append(root.getComponent('1L').intValue)
tags.append(str(root.Dados.Meta.TagPath+"/something"))
...

system.tag.writeAsync(tags, values)

```

### Best

```python
root = system.gui.getParentWindow(event).rootContainer

tags = [
	str(root.Dados.Meta.TagPath+"/something"),
	...
]
values = [
	root.getComponent('1L').intValue,
	...
]

system.tag.writeAsync(tags, values)

```

Writing out a bunch of `abc1`, `abc2`, `abc3` variables is pointless - at best it invites typos.

---

<div class="post-metadata">

**Author:** ![diego.marques](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/diego.marques/32/79285_2.png) [@diego.marques](https://forum.inductiveautomation.com/u/diego.marques)\
**Post date:** [August 28, 2025, 4:35pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/4 "2025-08-28T16:35:54Z")

</div>

> [@pturmel](#):
>
> Should be like:
> 
> ```python
> preset_values = [preset1,...preset14]
> tag_paths = [tag1,,...tag14]
> 
> ```

Thank you for pointing that, I fixed this one!

> [@paul-griffith](#):
>
> ### Best
> 
> ```python
> root = system.gui.getParentWindow(event).rootContainer
> 
> tags = [
> str(root.Dados.Meta.TagPath+"/something"),
> ...
> ]
> values = [
> root.getComponent('1L').intValue,
> ...
> ]
> 
> system.tag.writeAsync(tags, values)
> 
> ```

I modified my code to match this example, but it’s still not working properly. Some tags are written and some are not. I’m starting to think it might be related to some gateway read/write configuration.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 28, 2025, 4:38pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/5 "2025-08-28T16:38:13Z")

</div>

Provide a callback to receive the write status codes, and log them.

---

<div class="post-metadata">

**Author:** ![diego.marques](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/diego.marques/32/79285_2.png) [@diego.marques](https://forum.inductiveautomation.com/u/diego.marques)\
**Post date:** [August 28, 2025, 5:57pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/6 "2025-08-28T17:57:52Z")

</div>

@pturmel

I received a positive feedback from callBack, but most of my values ​​were not sent to the PLC.

> **Script console**
>
> ![script_console](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/c/4c55619f741920b150bcbb0f1bd0407938214288.png)

> **Output console**
>
> ![output_console](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/7/8776f11621a4be4e77cd437903617a69de990b2c.png)

If I click countless times `Execute` in Script console, eventually some values are sent, but not all of them. Same with my button at runtime.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 28, 2025, 7:00pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/7 "2025-08-28T19:00:15Z")

</div>

> [@diego.marques](#):
>
> values ​​were not sent to the PLC.

`system.tag.write` is **not** writing directly to the device. It is writing to the Ignition Tag. Depending on the type of tag that is, how it is configured, and how the device is configured, values may take longer than you’re expecting to be written to the PLC. Note that it is also possible that the device itself is over writing your values and so they are being sent but the PLC is wiping them out.

---

<div class="post-metadata">

**Author:** ![Samuel\_Sueur](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Samuel\_Sueur](https://forum.inductiveautomation.com/u/Samuel_Sueur)\
**Post date:** [August 28, 2025, 7:10pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/8 "2025-08-28T19:10:35Z")

</div>

> [@diego.marques](#):
>
> I modified my code to match this example, but it’s still not working properly

I have to point out that your code **does not** match the example.

In your screenshot, line 20 **is not a list**. In Paul’s example, it is definitely a list, so line 20 should be:

`values = [1,2,3,4,5,6,7…]`

Likewise, your `tags` variable **is not a list aswell**. It is a tuple.

So on line 6, your variable declaration should be:

`tags = ['path1', 'path2', 'path3'…]`

Please note the use of brackets instead of parenthesis.

Also, please do not specify `.value` in your list of paths. By default, a value is written to the value of a tag if nothing is specified in the path ( .documentation, .tooltip, etc…)

---

<div class="post-metadata">

**Author:** ![diego.marques](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/diego.marques/32/79285_2.png) [@diego.marques](https://forum.inductiveautomation.com/u/diego.marques)\
**Post date:** [August 28, 2025, 8:03pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/9 "2025-08-28T20:03:29Z")

</div>

> [@Samuel\_Sueur](#):
>
> I have to point out that your code **does not** match the example.

@Samuel_Sueur Sorry about that, I modified to test with script console…on my root container the code is as follows:

> **Button script**
>
> ![btn](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/4/34bbf354be45f142805d263f3ef474bcdcb9cfe3.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 28, 2025, 8:08pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/10 "2025-08-28T20:08:44Z")

</div>

Post code, not pics of code. (You did so well in your OP but then fell on your face...)

---

<div class="post-metadata">

**Author:** ![diego.marques](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/diego.marques/32/79285_2.png) [@diego.marques](https://forum.inductiveautomation.com/u/diego.marques)\
**Post date:** [August 28, 2025, 8:13pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/11 "2025-08-28T20:13:23Z")

</div>

Here it is:

```python
def callBack(asyncReturn):
	if not all(case.good for case in asyncReturn):
		print "Error writeAsync quality codes:" + str(asyncReturn) + "."
	else:
		print "writeAsync ok"
root = system.gui.getParentWindow(event).rootContainer
tags = [
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_1L"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_2L"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_3L"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_4L"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_5L"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_6L"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_7L"),
	
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_1H"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_2H"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_3H"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_4H"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_5H"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_6H"),
	str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_7H")
		]
values = [
	root.getComponent('1L').intValue,
	root.getComponent('2L').intValue,
	root.getComponent('3L').intValue,
	root.getComponent('4L').intValue,
	root.getComponent('5L').intValue,
	root.getComponent('6L').intValue,
	root.getComponent('7L').intValue,
	
	root.getComponent('1H').intValue,
	root.getComponent('2H').intValue,
	root.getComponent('3H').intValue,
	root.getComponent('4H').intValue,
	root.getComponent('5H').intValue,
	root.getComponent('6H').intValue,
	root.getComponent('7H').intValue
		]

system.tag.writeAsync(tags, values, callBack)

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 28, 2025, 8:40pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/12 "2025-08-28T20:40:13Z")

</div>

I don't see anything obviously wrong. It may not be a script issue.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [August 28, 2025, 8:43pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/13 "2025-08-28T20:43:37Z")

</div>

You might have it print/log the tag paths and values to make sure you're getting what you expect.

---

<div class="post-metadata">

**Author:** ![diego.marques](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/diego.marques/32/79285_2.png) [@diego.marques](https://forum.inductiveautomation.com/u/diego.marques)\
**Post date:** [August 29, 2025, 12:16pm UTC](https://forum.inductiveautomation.com/t/system-tag-write-not-writing-all-tags/110243/14 "2025-08-29T12:16:25Z")

</div>

I ended up writing this code, using this method **all my values**  **are sent** to the PLC via MQTT, but unfortunately I couldn’t get rid of the sleep() function:

```python
system.tag.writeBlocking(["[default]Animation/HabWait"], True)
root = system.gui.getParentWindow(event).rootContainer
tag_writes = [
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_1L"), "value": root.getComponent('1L').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_2L"), "value": root.getComponent('2L').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_3L"), "value": root.getComponent('3L').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_4L"), "value": root.getComponent('4L').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_5L"), "value": root.getComponent('5L').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_6L"), "value": root.getComponent('6L').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_7L"), "value": root.getComponent('7L').intValue},	
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_1H"), "value": root.getComponent('1H').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_2H"), "value": root.getComponent('2H').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_3H"), "value": root.getComponent('3H').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_4H"), "value": root.getComponent('4H').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_5H"), "value": root.getComponent('5H').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_6H"), "value": root.getComponent('6H').intValue},
	{"path": str(root.Dados.Meta.TagPath+"/PRESET_LIMITES/LIMITE_7H"), "value": root.getComponent('7H').intValue}
		]
for i in range(1): # Iterates from 0 to 1
        if(system.gui.confirm("Write values?", "Confirm")):
			if(event.source.parent.getComponent('HabWait').visible):
				for item in tag_writes:
					from time import sleep
					values=item["value"]
					paths=item["path"]
					def write (values=values):
						system.tag.writeAsync(paths, values)
					system.util.invokeAsynchronous(write) # Pause execution for the specified delay
					sleep(1) #delay
			system.gui.messageBox("Updated", "Ok!")
system.tag.writeBlocking(["[default]Animation/HabWait"], False)

```

Thank you for your support!
