# Tie Status of a fault bool to whether any fault is active

**URL:** <https://forum.inductiveautomation.com/t/tie-status-of-a-fault-bool-to-whether-any-fault-is-active/52481>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [October 28, 2021, 9:09pm UTC](https://forum.inductiveautomation.com/t/tie-status-of-a-fault-bool-to-whether-any-fault-is-active/52481 "2021-10-28T21:09:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![markusx1094](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@markusx1094](https://forum.inductiveautomation.com/u/markusx1094)\
**Post date:** [October 28, 2021, 9:09pm UTC](https://forum.inductiveautomation.com/t/tie-status-of-a-fault-bool-to-whether-any-fault-is-active/52481/1 "2021-10-28T21:09:34Z")

</div>

I’ve got 9 PRV fans to tie to and on the maintenance page I would like to tie a fault value to be true if any of the PRV faults are true. I had tried to do this through an expression if statement but all that did was make the status constantly blink between true and false.

```auto
if ({[default]PRV's/PRV 2/Fault} || {[default]PRV's/PRV 18/Fault} 
	|| {[default]PRV's/PRV 19/Fault} || {[default]PRV's/PRV 20/Fault} 
	|| {[default]PRV's/PRV 21/Fault} || {[default]PRV's/PRV 22/Fault} 
	|| {[default]PRV's/PRV 23/Fault} || {[default]PRV's/PRV 24/Fault} 
	|| {[default]PRV's/PRV 32/Fault} = 1,
	
	{Root Container.Status Labels.Fault Status.status}=1,
	{Root Container.Status Labels.Fault Status.status}=0)
```

I’m sure there is a better way to do this through scripting but I’m not quite sure how I would go about calling multiple tag values while running it through expression bindings. I do have simulation aids module if using objectScript() would make it easier. From what I read up online you can use the python any function to do something like this.

```auto
def globalFaultCheck(prvPath)
	
	prvNums = [2, 18, 19, 20, 21, 22, 23, 24, 32]
	
	
	any_good = any(
		prvPath == true
		for x in prvNums
	)
	return any_good
```

objectScript()

```auto
objectScript("conditionals.globalFaultCheck", {[default]PRV's/PRV 2/Fault})
```

Two main problems with this code. One is that it only checks the fault of one prv which is way easier to do using indirect bindings. The other problem is that it throws an error code which is kind of obvious because there is no bool attached to those values in the script. Just not sure how to fix that issue.  
File “expression:objectScript”, line 1, in   
SyntaxError: (“no viable alternative at input ‘\n\n’”, (‘module:conditionals’, 3, 4, ‘def \n’)

Edit: Grammar

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [October 28, 2021, 9:46pm UTC](https://forum.inductiveautomation.com/t/tie-status-of-a-fault-bool-to-whether-any-fault-is-active/52481/2 "2021-10-28T21:46:17Z")

</div>

I think you are over complicating it.

You should be able to achieve this through the alarm count tags.

[https://docs.inductiveautomation.com/display/DOC81/Alarming#Alarming-AlarmCountTags](https://docs.inductiveautomation.com/display/DOC81/Alarming#Alarming-AlarmCountTags)

 ![alarm](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/4/d4cb41007b210c836d87dbecfcdf098fccdff4b6.png)

you should only need 1 line of script. i.e.

`alarmcount > 0 writetotag true else writetotag false`.

\*I know that was horrible pseudocode. if you need I can actually write it for you, just super busy right now.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 28, 2021, 10:08pm UTC](https://forum.inductiveautomation.com/t/tie-status-of-a-fault-bool-to-whether-any-fault-is-active/52481/3 "2021-10-28T22:08:52Z")

</div>

> [@andrews](#):
>
> You should be able to achieve this through the alarm count tags.

This set of tags is for _all_ tags in the provider, not just specific folders. In other SCADA's they have these similar set of counts available to all folders which is super handy. Ignition however doesn't have this feature. I made something similar within a couple UDTs.

> [@markusx1094](#):
>
> I had tried to do this through an expression if statement but all that did was make the status constantly blink between true and false.

I don't understand why this expression would blink unless your Fault tags blink? Also, you can't write to objects inside an expression as in here:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/2/122c243dbbd9144e10448913d398330fc80064a5.png)

This should simply be:

```auto
   {[default]PRV's/PRV 2/Fault}
|| {[default]PRV's/PRV 18/Fault} 
|| {[default]PRV's/PRV 19/Fault}
|| {[default]PRV's/PRV 20/Fault} 
|| {[default]PRV's/PRV 21/Fault}
|| {[default]PRV's/PRV 22/Fault} 
|| {[default]PRV's/PRV 23/Fault}
|| {[default]PRV's/PRV 24/Fault} 
|| {[default]PRV's/PRV 32/Fault}

```

Grievance: you should remove the apostrophe from your tag name. It will cause you nothing but issues. I'm surprised it's even allowed tbh 😰

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [October 29, 2021, 2:52am UTC](https://forum.inductiveautomation.com/t/tie-status-of-a-fault-bool-to-whether-any-fault-is-active/52481/4 "2021-10-29T02:52:02Z")

</div>

Maybe something to be added as a feature request on the idea page.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 29, 2021, 3:08am UTC](https://forum.inductiveautomation.com/t/tie-status-of-a-fault-bool-to-whether-any-fault-is-active/52481/5 "2021-10-29T03:08:48Z")

</div>

Pretty sure I had one already for it from years ago, can’t find it though… 😕 maybe i’ll make a new one at some stage

---

<div class="post-metadata">

**Author:** ![markusx1094](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@markusx1094](https://forum.inductiveautomation.com/u/markusx1094)\
**Post date:** [October 29, 2021, 12:31pm UTC](https://forum.inductiveautomation.com/t/tie-status-of-a-fault-bool-to-whether-any-fault-is-active/52481/6 "2021-10-29T12:31:58Z")

</div>

Yea I kind of figured I was overcomplicating it. The only problem with the alarm count tags is like @nminchin said, where that set of tags is for all tags in the provider. This project is just a mini project that will be integrated into an actual farm project once its finished so it needs to call to just those situations.

---

<div class="post-metadata">

**Author:** ![markusx1094](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@markusx1094](https://forum.inductiveautomation.com/u/markusx1094)\
**Post date:** [October 29, 2021, 12:38pm UTC](https://forum.inductiveautomation.com/t/tie-status-of-a-fault-bool-to-whether-any-fault-is-active/52481/7 "2021-10-29T12:38:40Z")

</div>

Sweet thank you that worked for me. That would be helpful to add a set of counts to reference specific folders or to have a check any/all function similar to how the scripting works rather than using ‘or’ and ‘and’ logic, though I’m not sure how that would be implemented into expression language as you generally need to have a list or dictionary for that anyways. I’ve had some issues with the naming already so I’ll change that before I get too much farther in my project.

Edit: Grammar
