# I need help with a script that will update the values of tags

**URL:** <https://forum.inductiveautomation.com/t/i-need-help-with-a-script-that-will-update-the-values-of-tags/99680>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [December 11, 2024, 8:08am UTC](https://forum.inductiveautomation.com/t/i-need-help-with-a-script-that-will-update-the-values-of-tags/99680 "2024-12-11T08:08:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tex\_Hen](https://avatars.discourse-cdn.com/v4/letter/t/3ec8ea/32.png) [@Tex\_Hen](https://forum.inductiveautomation.com/u/Tex_Hen)\
**Post date:** [December 11, 2024, 8:08am UTC](https://forum.inductiveautomation.com/t/i-need-help-with-a-script-that-will-update-the-values-of-tags/99680/1 "2024-12-11T08:08:26Z")

</div>

Hello all,

I need a script that will use the values from "ImpA" which is located in a memory tag dataset to update my values in the "Ideal Current" tags.  
My CB folders are 23(CB 1...CB 23).

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/e/ae022d0191e07b2111b2d20de3bf78d6bf5ba1b4.png)

---

<div class="post-metadata">

**Author:** ![dominik.juhasz](https://avatars.discourse-cdn.com/v4/letter/d/e99b99/32.png) [@dominik.juhasz](https://forum.inductiveautomation.com/u/dominik.juhasz)\
**Post date:** [December 11, 2024, 9:14am UTC](https://forum.inductiveautomation.com/t/i-need-help-with-a-script-that-will-update-the-values-of-tags/99680/2 "2024-12-11T09:14:01Z")

</div>

could be something like this

```python
# type here you ds tag paht
dsTagPath = ''
# fix your destination path
cbBasePath = '....../Inverter %s/DC Inputs/CB %s'

# read you DS here
dataset = system.tag.readBlocking([dsTagPath])[0].value

tagPaths = []
values = []
for row in system.dataset.toPyDataSet(dataset):
	cbNumber = str(row['CBNumber'])
	inverterNumber = str(row['InverterNumber'])
	impA = row['ImpA'] 
	
	tagPaths.append( cbBasePath % (inverterNumber, cbNumber) )
	values.append( impA) 

# your final write
system.tag.writeBlocking(tagPaths, values)

```

---

<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:** [December 11, 2024, 2:42pm UTC](https://forum.inductiveautomation.com/t/i-need-help-with-a-script-that-will-update-the-values-of-tags/99680/3 "2024-12-11T14:42:22Z")

</div>

Is there a good reason that you are not using expression bindings that would be much faster and easier on resources?

---

<div class="post-metadata">

**Author:** ![Tex\_Hen](https://avatars.discourse-cdn.com/v4/letter/t/3ec8ea/32.png) [@Tex\_Hen](https://forum.inductiveautomation.com/u/Tex_Hen)\
**Post date:** [December 11, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/i-need-help-with-a-script-that-will-update-the-values-of-tags/99680/4 "2024-12-11T14:53:41Z")

</div>

I didn't think that of that. Wouldn't that require going into each folder and creating the expression(which might take longer)?

---

<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:** [December 11, 2024, 3:32pm UTC](https://forum.inductiveautomation.com/t/i-need-help-with-a-script-that-will-update-the-values-of-tags/99680/5 "2024-12-11T15:32:20Z")

</div>

Are you not using a UDT for each breaker? That usually simplifies this sort of thing (after the initial head-scratching). You can make a parameter on the UDT for the CB number and use that in the expression binding to look up the appropriate value in the dataset.

See the Dataset Access section:

> **[Expression Language and Syntax | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/platform/expression-language-and-syntax#dataset-access)**
>
> Expression Language
