Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Hour | Minutes | Int_Flag | Hour_Flag |
1 | 0 | 0 | 1 |
1 | 5 | 0 | 1 |
1 | 10 | 0 | 1 |
1 | 15 | 1 | 1 |
1 | 20 | 1 | 1 |
1 | 25 | 1 | 1 |
1 | 30 | 1 | 1 |
1 | 35 | 0 | 1 |
1 | 40 | 0 | 1 |
1 | 45 | 0 | 1 |
1 | 50 | 0 | 1 |
1 | 55 | 0 | 1 |
2 | 0 | 1 | 0 |
2 | 5 | 1 | 0 |
2 | 10 | 1 | 0 |
2 | 15 | 0 | 0 |
2 | 20 | 1 | 0 |
2 | 25 | 1 | 0 |
2 | 30 | 1 | 0 |
2 | 35 | 0 | 0 |
2 | 40 | 0 | 0 |
2 | 45 | 1 | 0 |
2 | 50 | 1 | 0 |
2 | 55 | 1 | 0 |
3 | 0 | 1 | 0 |
3 | 5 | 1 | 0 |
3 | 10 | 1 | 0 |
3 | 15 | 0 | 0 |
3 | 20 | 0 | 0 |
3 | 25 | 0 | 0 |
3 | 30 | 0 | 0 |
3 | 35 | 0 | 0 |
3 | 40 | 0 | 0 |
3 | 45 | 0 | 0 |
3 | 50 | 0 | 0 |
3 | 55 | 0 | 0 |
hei
try this example
hope its helps you
Thank you. I believe this will work fine.