May I know how to PI event count for Bad Values of Tag for specific duration.
Do you want to do continuously or just for reporting purposes?
I want for both.
With the latest release, you can use the RecordedValuesByCount function followed by the FilterData function to give you an array of BadVal(). Then you can use the Count function to give you a count of the BadVal() of a time range.
Thanks Stephen. Since I am new to PI World, can you please explain in detail.
I did this slightly different than Steve's recommendation, but close enough.
Build an array of values (in this example, it will build an array of all values from the attribute for the last hour):
RecordedValues('Test Input','*','*-1d') (Step Name is InitArray)
Next - filter them out (this step culls reduces the array to just the bad values:
FilterData(InitArray, BadVal($val)) (Step Name is Filter)
Then, count the bad values by reporting the length of the array:
Map that last step to an output attribute that writes to a PI tag.
Hope this helps.
Retrieving data ...