# Tag writeblocking multiple tags to one value

**URL:** <https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411>\
**Category:** Ignition\
**Created:** [February 22, 2022, 2:54pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411 "2022-02-22T14:54:07Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [February 22, 2022, 2:54pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/1 "2022-02-22T14:54:07Z")

</div>

the guide says

```auto
# Create a list with the tag paths to be updated.
paths = ["[default]Folder/Tag_A","[default]Folder/Tag_B"]
 
# Create a list with the update values, one value for each path.
values = [1,2]
 
# Execute the write operation.
system.tag.writeBlocking(paths, values)

```

If you want to write a hundred tags to 0, do you need a values list with 100 comma separated zeroes?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 22, 2022, 2:59pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/2 "2022-02-22T14:59:27Z")

</div>

> [@zacharyw.larson](#):
>
> do you need a values list with 100 comma separated zeroes

You need a list with 100 elements in it... work smarter though.

One of infinite possibilities:

```auto
values = [0] * 100

```

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [February 22, 2022, 3:05pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/3 "2022-02-22T15:05:23Z")

</div>

@zacharyw.larson  
check out the following link

> **[List Comprehensions in Python - PythonForBeginners.com](https://www.pythonforbeginners.com/basics/list-comprehensions-in-python)**
>
> List Comprehensions in Python will help you improve your python skills with easy to follow examples and tutorials. Click here to view code examples.

List comprehensions are one of the nicest features of python and will save you a lot of time/lines of code.

You can incorporate if/else statements in them. Say I wanted all even numbers between 0 and 100 I could do it with just an if statement like

`evens_only = [x for x in range(0,101) if x%2==0]`

Now say I wanted to do a string ‘even’ for evens and ‘odd’ for odds I could do

`labels = ['Even' if x%2==0 else 'Odd' for x in range(0,101)]`

Take the time to learn about list comprehensions it will save you a ton of code and once you get used to it it is much more readable imo.

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [February 22, 2022, 3:07pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/4 "2022-02-22T15:07:41Z")

</div>

Thanks very much

Does that mean this works for spaces:  
`values =[" "]*14`

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [February 22, 2022, 3:10pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/5 "2022-02-22T15:10:23Z")

</div>

A great way to learn and play with it to see what works is in your designer click on Tools and then click on Script console. You can type a few lines in the left hand side and click execute, or you can type directly into the REPL on the right hand side and execute statements one at time.

To your question

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/6/860a221e17e646bcd957843a91f18125a30c05e9.png)

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [February 22, 2022, 3:18pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/6 "2022-02-22T15:18:33Z")

</div>

thanks that helps a ton

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [February 22, 2022, 3:25pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/7 "2022-02-22T15:25:56Z")

</div>

I tried to follow the example:

```auto
# Create a list with the tag paths to be updated.
paths = ["[default]Folder/Tag_A","[default]Folder/Tag_B"]
 
# Create a list with the update values, one value for each path.
values = [1,2]
 
# Execute the write operation.
system.tag.writeBlocking(paths, values)

```

I think the color changing is bad.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/5/6521e17e12a4ded555d7197351a53370eb7f8858.png)

---

<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:** [February 22, 2022, 3:41pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/8 "2022-02-22T15:41:20Z")

</div>

I don’t think your tag path is valid.

Also, as has already been said, work smarter not harder. Anytime you can make the code do the work for you, do it.

Try this:

```python
numComments = 14
pathsComments = ["[Test]SomeTagPath/Comment{}".format(path) for path in range(1,numComments + 1)]
value14Spaces = ["space"]*numComments

for c in range(numComments):
    print "commentPath: ",pathsComments[c], " ","value:" , value14Spaces[c]

```

I used “space” because its not easy to see if you’ve actually printed a space or not.

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [February 22, 2022, 3:53pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/9 "2022-02-22T15:53:01Z")

</div>

I was trying to take a shortcut to make my example like my problem.  
Sorry about that, it wasn’t like comment 1-14 in the same folder.

I was deleting to make my folder paths more uniquely categorical.

Then I saw the culprit  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/6/36f828fd6a8c4c24066ef10b5b1b2103ecc5c873.png)  
I have some kind of impostor quotations in there.

Thanks for helping me.

---

<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:** [February 22, 2022, 4:05pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/10 "2022-02-22T16:05:39Z")

</div>

> [@zacharyw.larson](#):
>
> I have some kind of impostor quotations in there.

That happens when posters here fail to use the pre-formatted text button for the code they paste, and then you copy from it. When the forum software sees quoted text that isn't pre-formatted, it makes it "pretty" with curly quotes. Like around "pretty".

Rule of thumb: Don't copy from code that wasn't formatted.

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [February 22, 2022, 4:08pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/11 "2022-02-22T16:08:39Z")

</div>

I appreciate the rule of thumb and help.

This one was self inflicted I think.  
I am sure this is a cardinal sin.  
I used MS word instead of notepad to edit my text.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 22, 2022, 4:10pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/12 "2022-02-22T16:10:12Z")

</div>

Notepad is only marginally better.

Get yourself a real text editor… Sublime Text, Nodepad++, VS Code, anything…

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [February 22, 2022, 4:37pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/13 "2022-02-22T16:37:29Z")

</div>

I used Notepad++ before. I will use that.

Thanks for encouragement and guidance

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [February 24, 2022, 6:40pm UTC](https://forum.inductiveautomation.com/t/tag-writeblocking-multiple-tags-to-one-value/56411/14 "2022-02-24T18:40:40Z")

</div>

Thanks, I am soon going to be using something like you had posted

```auto
numComments = 14
pathsComments = ["[Test]SomeTagPath/Comment{}".format(path) for path in range(1,numComments + 1)]
value14Spaces = ["space"]*numComments

for c in range(numComments):
    print "commentPath: ",pathsComments[c], " ","value:" , value14Spaces[c]

```

a smattering of tags are arranged in a way that they have a number that increases to separate them
