# writeBlocking from a popup using a parameter

**URL:** <https://forum.inductiveautomation.com/t/writeblocking-from-a-popup-using-a-parameter/93927>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [July 30, 2024, 5:42pm UTC](https://forum.inductiveautomation.com/t/writeblocking-from-a-popup-using-a-parameter/93927 "2024-07-30T17:42:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BRYAN\_MOBLEY](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@BRYAN\_MOBLEY](https://forum.inductiveautomation.com/u/BRYAN_MOBLEY)\
**Post date:** [July 30, 2024, 5:42pm UTC](https://forum.inductiveautomation.com/t/writeblocking-from-a-popup-using-a-parameter/93927/1 "2024-07-30T17:42:55Z")

</div>

Can anyone tell me why this script doesn't work for me?

```python
indirect = self.view.params.MachineNumber
 
path = '[default]CL1/{}/To Auto Mode'.format(indirect)

system.tag.writeBlocking(path, 'true')

```

I don't see anything in the log when I press the button to run it. I can run the script just fine in the console if I change the path for indirect to a valid path inside of "".

---

<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:** [July 30, 2024, 5:54pm UTC](https://forum.inductiveautomation.com/t/writeblocking-from-a-popup-using-a-parameter/93927/2 "2024-07-30T17:54:54Z")

</div>

> [@BRYAN\_MOBLEY](#):
>
> system.tag.writeBlocking(path, 'true')

You're writing a string `"true"` to the tag. I presume you should be writing a boolean, in which case it would be,  
`system.tag.writeBlocking([path], [True])`

Both arguements of writeBlocking expect lists, `[]`, although it tolerates single elements.

There may be other problems that I haven't spotted.

---

<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:** [July 30, 2024, 6:16pm UTC](https://forum.inductiveautomation.com/t/writeblocking-from-a-popup-using-a-parameter/93927/3 "2024-07-30T18:16:37Z")

</div>

Aside from the use of a String as opposed to a Boolean value as @Transistor details.

I presume that the MachineNumber is an integer. In which case it is possible that the resultant path would be different from the expected path.

For instance for machine number 1 the path you would get from this script is:

```python
'[default]CL1/1/To Auto Mode'

```

Which if you were expecting a leading zero in the path, would not work.

All of that said? for something this simple why not use a bi-directional indirect tag binding?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [July 30, 2024, 6:19pm UTC](https://forum.inductiveautomation.com/t/writeblocking-from-a-popup-using-a-parameter/93927/4 "2024-07-30T18:19:32Z")

</div>

All of the above, plus get rid of spaces in tag paths. And any other whitespace.  
Actually anything that's not a letter, digit or underscore.

---

<div class="post-metadata">

**Author:** ![BRYAN\_MOBLEY](https://avatars.discourse-cdn.com/v4/letter/b/db5fbb/32.png) [@BRYAN\_MOBLEY](https://forum.inductiveautomation.com/u/BRYAN_MOBLEY)\
**Post date:** [July 30, 2024, 6:34pm UTC](https://forum.inductiveautomation.com/t/writeblocking-from-a-popup-using-a-parameter/93927/5 "2024-07-30T18:34:47Z")

</div>

param is a string.

Was just trying to get it working with a button instead of a toggle switch. Toggle switch works great.
