# Running the script after entering the values

**URL:** <https://forum.inductiveautomation.com/t/running-the-script-after-entering-the-values/34115>\
**Category:** Ignition\
**Created:** [April 22, 2020, 10:25am UTC](https://forum.inductiveautomation.com/t/running-the-script-after-entering-the-values/34115 "2020-04-22T10:25:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oleh](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@Oleh](https://forum.inductiveautomation.com/u/Oleh)\
**Post date:** [April 22, 2020, 10:25am UTC](https://forum.inductiveautomation.com/t/running-the-script-after-entering-the-values/34115/1 "2020-04-22T10:25:28Z")

</div>

Hello.  
I need running the script after entering the values to the Numeric Text Field. I use Ignition 7.5.12. In the latest version ignition i know how to do it with tag change scripting.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 22, 2020, 11:26am UTC](https://forum.inductiveautomation.com/t/running-the-script-after-entering-the-values/34115/2 "2020-04-22T11:26:13Z")

</div>

Use a Gateway Tag Change Script.

 ![2020-04-22_7-23-46](https://us1.discourse-cdn.com/inductiveautomation/original/2X/d/d84d440dca2eebb38e6cdbd3bd231ee3dfe850df.png)

---

<div class="post-metadata">

**Author:** ![Oleh](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@Oleh](https://forum.inductiveautomation.com/u/Oleh)\
**Post date:** [April 22, 2020, 1:41pm UTC](https://forum.inductiveautomation.com/t/running-the-script-after-entering-the-values/34115/3 "2020-04-22T13:41:11Z")

</div>

![%D0%91%D0%B5%D0%B7%D1%8B%D0%BC%D1%8F%D0%BD%D0%BD%D1%8B%D0%B9](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e291d5159a8434f911e731b924f40fc7cf62e929.png) ![%D0%91%D0%B5%D0%B7%D1%8B%D0%BC%D1%8F%D0%BD%D0%BD%D1%8B%D0%B91](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/8ac8e3d8ea20479bba1c5dc68b361f200d2d9437.png) ![%D0%91%D0%B5%D0%B7%D1%8B%D0%BC%D1%8F%D0%BD%D0%BD%D1%8B%D0%B93](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/618f46eae119c972341a327d6215eca15f7ed888.png)

---

<div class="post-metadata">

**Author:** ![Oleh](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@Oleh](https://forum.inductiveautomation.com/u/Oleh)\
**Post date:** [April 22, 2020, 1:43pm UTC](https://forum.inductiveautomation.com/t/running-the-script-after-entering-the-values/34115/4 "2020-04-22T13:43:37Z")

</div>

The script works in the console but if I put to Gateway Tag Change Script it does not work

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [April 22, 2020, 2:34pm UTC](https://forum.inductiveautomation.com/t/running-the-script-after-entering-the-values/34115/5 "2020-04-22T14:34:49Z")

</div>

Did you save the project after you entered the script?

---

<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:** [April 22, 2020, 2:40pm UTC](https://forum.inductiveautomation.com/t/running-the-script-after-entering-the-values/34115/6 "2020-04-22T14:40:26Z")

</div>

Depending on where you put it in your gateway scripts, you may need to include the provider in all of your tag paths.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [April 22, 2020, 3:47pm UTC](https://forum.inductiveautomation.com/t/running-the-script-after-entering-the-values/34115/7 "2020-04-22T15:47:41Z")

</div>

Be sure to use the tag provider, as other have said. If you are only doing this process in one spot, your script is perfectly okay (once the tag provider is added in). however, if you need to do this in multiple locations, then read on… 🙂

Since all the tags are in the same folder, you can derive the parent path from the event’s tagPath and itemName. If you use the parent path in your script, that will do two things for you:

- It will automatically keep track of the tag provider for you.
- You won’t need any extra typing. You can just add the tag to monitor list.

```python
# Get tag path and set parent path
# I don't think parentPath property was added 
# until later, but we can still calculate it.
tagPath = str(event.tagPath)
itemName = str(event.tagPath.itemName)
parentPath = tagPath[:-(len(itemName))]

PR_value = newValue.value
PR1_value = system.tag.read(path + 'KTP680Power').value

# Specify the tag paths
paths = [
			parentPath + 'KTP1Power',
			parentPath + 'KTP2Power',
			parentPath + 'KTP3Power',
			parentPath + 'KTP4Power'
        ]

# Specify the values
paths = [
			PR_value,
			PR_value,
			PR_value,
			PR1_value
        ]

system.tag.write(paths, values)

```

---

<div class="post-metadata">

**Author:** ![Oleh](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@Oleh](https://forum.inductiveautomation.com/u/Oleh)\
**Post date:** [April 23, 2020, 4:44pm UTC](https://forum.inductiveautomation.com/t/running-the-script-after-entering-the-values/34115/8 "2020-04-23T16:44:32Z")

</div>

Thanks, it worked
