# Expression tag - runScript() issue (ignition 7.9)

**URL:** <https://forum.inductiveautomation.com/t/expression-tag-runscript-issue-ignition-7-9/58338>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [April 12, 2022, 1:31am UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript-issue-ignition-7-9/58338 "2022-04-12T01:31:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samantha\_Bidwell1](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Samantha\_Bidwell1](https://forum.inductiveautomation.com/u/Samantha_Bidwell1)\
**Post date:** [April 12, 2022, 1:31am UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript-issue-ignition-7-9/58338/1 "2022-04-12T01:31:33Z")

</div>

Creating a new expression tag that when holds a True value runs one of my functions every 5 seconds.

Tag Diagnostics state “Error evaluating tag: Error executing script for runScript() expression:shared.ofs.main.monitorPtValueReset()”  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/b/cb6189effa9f04399a687abf9d5b7352672a4531.png)

Within the expression the code written is

```auto
runScript("shared.ofs.main.monitorPtValueReset()", 5000)

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/c/0ca2f565a9214c6873bb4e61427fa00d57017680.png)

The function is created to intermittently check the line status and stop downtime spans once the line is running. Code is as follows:

```auto
def monitorPtValueReset(tagPath):	
		
	
	readURL = SERVER + TEST_LINE + LINE_POSTFIX + RUNNING_CHECK_ENDPOINT
	response = system.net.httpGet(readURL, username=USER, password=PASS)
	
	r = system.util.jsonDecode(response)
	if(r['spanClass'] == 'Running'):
		running = True
	else:
		running = False
		
	
	if (running):				
		#Build corresponding monitor point paths
 	    currentLine = tagPath.split('/')[0]
		currentLinePost = tagPath.split('/')[1]
		current_SMP_path = currentLine + "/" + currentLinePost + "/MP_SKUChange"
		current_BMP_path = currentLine + "/" + currentLinePost + "/MP_BatchChange"
	
		# there will be instances where one MP is true while the other is false 
        # to prevent object finding issues, only run reset on MP that requires it 
		
		current_SMP_status = system.tag.read(current_SMP_path).value 
		if (current_SMP_status):
			# reset monitor points and stop relative spans via endpoint
			system.tag.write(current_SMP_path, False)
			endpointURL = SERVER + TEST_LINE + LINE_POSTFIX + SIZE_STOP
			system.net.httpGet(endpointURL,username=USER, password=PASS)
			
		current_BMP_status = system.tag.read(current_BMP_path).value 
		if (current_BMP_status):
			system.tag.write(current_BMP_path, False)
			endpointURL = SERVER + TEST_LINE + LINE_POSTFIX + BATCH_STOP
            system.net.httpGet(endpointURL,username=USER, password=PASS)

```

I’m hoping a pair of fresh eyes can help resolve the error. Thank you

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [April 12, 2022, 1:36am UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript-issue-ignition-7-9/58338/2 "2022-04-12T01:36:06Z")

</div>

I don’t see where you are passing a tag path to `monitorPtValueReset`

---

<div class="post-metadata">

**Author:** ![Samantha\_Bidwell1](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Samantha\_Bidwell1](https://forum.inductiveautomation.com/u/Samantha_Bidwell1)\
**Post date:** [April 12, 2022, 1:42am UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript-issue-ignition-7-9/58338/3 "2022-04-12T01:42:22Z")

</div>

it is utilised to read the relevant line that triggers the script to subsequently create other relevant tag paths

for example:  
within if (running): statement

```auto
if (running):				
		#Build corresponding monitor point paths
 	    currentLine = tagPath.split('/')[0]
		currentLinePost = tagPath.split('/')[1]
		current_SMP_path = currentLine + "/" + currentLinePost + "/MP_SKUChange"
		current_BMP_path = currentLine + "/" + currentLinePost + "/MP_BatchChange"

```

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [April 12, 2022, 1:43am UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript-issue-ignition-7-9/58338/4 "2022-04-12T01:43:14Z")

</div>

> [@Samantha\_Bidwell1](#):
>
> `def monitorPtValueReset(tagPath)`

Yet:  
`runScript("shared.ofs.main.monitorPtValueReset()", 5000)`

Try something like this;

```auto
runScript("shared.ofs.main.monitorPtValueReset", "[default]tag", 5000)

```

---

<div class="post-metadata">

**Author:** ![Samantha\_Bidwell1](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Samantha\_Bidwell1](https://forum.inductiveautomation.com/u/Samantha_Bidwell1)\
**Post date:** [April 12, 2022, 1:53am UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript-issue-ignition-7-9/58338/5 "2022-04-12T01:53:47Z")

</div>

ahhhh  
Apologies, I missed your meaning

resolved - thank you!
