# Not able to write to boolean tag

**URL:** <https://forum.inductiveautomation.com/t/not-able-to-write-to-boolean-tag/87489>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 18, 2024, 2:18pm UTC](https://forum.inductiveautomation.com/t/not-able-to-write-to-boolean-tag/87489 "2024-03-18T14:18:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Craig](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Ryan\_Craig](https://forum.inductiveautomation.com/u/Ryan_Craig)\
**Post date:** [March 18, 2024, 2:18pm UTC](https://forum.inductiveautomation.com/t/not-able-to-write-to-boolean-tag/87489/1 "2024-03-18T14:18:46Z")

</div>

I am having trouble finding the error in this code:

```auto
def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
	if currentValue == 3:
		system.tag.writeBlocking("[.]MultipleTestsPrgrm.value",1)
	else:
		system.tag.writeBlocking("[.]MultipleTestsPrgrm.value",0)

```

I am simply trying to flip a boolean tag to true when the currentValue of the tag changes to a 3, and flip the boolean tag to false on any other number.

Any ideas?

---

<div class="post-metadata">

**Author:** ![humphrey.daniel](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@humphrey.daniel](https://forum.inductiveautomation.com/u/humphrey.daniel)\
**Post date:** [March 18, 2024, 2:29pm UTC](https://forum.inductiveautomation.com/t/not-able-to-write-to-boolean-tag/87489/2 "2024-03-18T14:29:59Z")

</div>

Looks like you need your tag path to be a list, even if one tag.

> **[system.tag.writeBlocking | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-tag/system-tag-writeBlocking#syntax)**
>
> Writes values to tags at the given paths.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 18, 2024, 2:33pm UTC](https://forum.inductiveautomation.com/t/not-able-to-write-to-boolean-tag/87489/3 "2024-03-18T14:33:19Z")

</div>

1. writeBlocking is expecting two lists.  
`system.tag.writeBlocking(["[.]MultipleTestsPrgrm.value]", [1])`  
It may work for now when there is only one of each but it could break on a future upgrade.
2. Where is "[.]" pointing to? Have you got Project | General | Tag Settings | Default Provider set properly? Try changing `[.]` to `[default]` or whatever your default provider name is.

---

<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:** [March 18, 2024, 2:33pm UTC](https://forum.inductiveautomation.com/t/not-able-to-write-to-boolean-tag/87489/4 "2024-03-18T14:33:22Z")

</div>

currentValue is a complex, qualified value object. You need to pull out just the value property:  
`if currentValue.value == 3:`

---

<div class="post-metadata">

**Author:** ![Ryan\_Craig](https://avatars.discourse-cdn.com/v4/letter/r/45deac/32.png) [@Ryan\_Craig](https://forum.inductiveautomation.com/u/Ryan_Craig)\
**Post date:** [March 18, 2024, 2:38pm UTC](https://forum.inductiveautomation.com/t/not-able-to-write-to-boolean-tag/87489/5 "2024-03-18T14:38:16Z")

</div>

I added the to make it a list, and changed the [.] to the full tag path and it seems to work now. The [.] before the tag was added when I used the 'insert tag' button next to the scripting area. I just manually added the full tag path and it seem to fix it.  
Thanks!
