Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Tricky question regarding Flags

I have an unusual question that may not be even possible, but first some background.

I have created a QVW which reads information from several QVDs. The data loaded is in 5 minute averages (i.e One hour has 12 readings….5, 10, 15, 20, etc). All of the data is joined together in one table for calculation purposes. One of the evaluations I created is a flag field, which will read a '1' whenever that data I am comparing is out of tolerance and a '0' when it is.

Now here is the tricky part, if 4 (or more) consecutive intervals are flagged as a '1', the entire hour needs to be flagged. The key word is "consecutive".

To illustrate, I have created the table below:

For Hour 1, there are 4 consecutive flags; therefore the Hour_Flag should be a '1'.

Hour 2, although there are 9 flags in the hour, there isn't 4 consecutive flags. Therefore the Hour_Flag should be '0'.

You will also notice at the end of Hour 2 and the beginning of Hour 3, there are 6 consecutive flags. Since this occurs between 2 separate hours and neither hour contains the required 4 consecutive flags, both Hour_Flags should be '0'.

Any help is greatly appreciated. Thank you in advance of any time you put in answering this.

HourMinutesInt_FlagHour_Flag
1001
1501
11001
11511
12011
12511
13011
13501
14001
14501
15001
15501
2010
2510
21010
21500
22010
22510
23010
23500
24000
24510
25010
25510
3010
3510
31010
31500
32000
32500
33000
33500
34000
34500
35000
35500


1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hei

try this example

hope its helps you

View solution in original post

2 Replies
lironbaram
Partner - Master III
Partner - Master III

hei

try this example

hope its helps you

Anonymous
Not applicable
Author

Thank you. I believe this will work fine.