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

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.

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.

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()

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

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

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.

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.

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

This should simply be:

   {[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 :cold_sweat:

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

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

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.

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