SQL indirect tag questions

I was wondering if anyone could tell me if this was already in FPMI or if it is not if it would make a good idea for future improvement. If this is already available please tell me how would be the best way to accomplish it.

We have a screen that has about 20 Indirectly addressed SQL tags. These are accumulated tags. There is some occasions where a tag will go to bad/out of service which i think is what quality value of 404 means. However the last value that was in that tag remains, so when another formula comes along that sums up all the tag values on the screen it will pick up any value left in there even if that tag is now bad. So is there a way that when the tag value goes bad to 0 (zero) out the value? And this is where my thought was that maybe have something like the fallback value that is used in the SQL query screens would come in handy. That way if the tag goes to bad/invalid/out of service or whatever you want to call it then its value will drop to zero.

Thanks and have a great day.

The data quality for a tag is always available. So your indirect tag binding could be an expression binding instead that looked something like:

if(tag('path/to/' + {indirect.param} +'tagname.quality') != 192, 0, tag('path/to/' + {indirect.param} +'tagname'))

That binding will return zero if the quality is not good.

I do have somthing like that right now. I was just asking if there is a more efficient approach and if maybe as a future request have a simple check box that if the quality goes to bad it will automatically set it at zero. Your code though does look a little cleaner and nicer than mine, thanks for all the assist.

Have a great day.

You know what, that expression I posted won’t work, quality isn’t naturally an integer. This one will:

if( toString(tag('path/to/' + {indirect.param} +'tagname.quality')) != 'GOOD_DATA', 0, tag('path/to/' + {indirect.param} +'tagname') )