Condition true for a period of time

I am producing a report where one of the conditions to detect is if a tag is above a certain value for a consecutive period of time. I've loosely nutted out what I need to know, but am unsure of the correct direction to head in with it.
My thoughts are:
I have raw data for Turbidity
Query it at one minute samples over a one day period
Detect a sample of over 0.1 NTU
If 15+ consecutive samples are over 0.1 NTU flag it as a non-compliance (Boolean?)
Count the number of unique non-compliances (Integer?)
Ideally this would be a query which would return the bool and int and take date start and date end (i.e. four parameters)
AnyAny help would be much appreciated.
ChCheers,
Chris

Hi deltahfturbo,
According to your description, you want to use a query to get the total non-compliance samples and the status of samples (compliance or not) with date start and end. Right?
In this scenario, we can use case when statement in your query to return true/false the amount of non-compliance samples exceeds 15. Please refer to query below:
declare @startdate date
set @startdate='2014/1/1'
declare @enddate date
set @enddate='2014/1/7'
select sum(
case when [NTU]>0.2 THEN 1
else 0
end
) as sample,
case when sum(
case when [NTU]>0.2 THEN 1
else 0
end
)>15 then 'non-compliance '
else 'compliance'
end
) as status,
@startdate as StartDate,
@enddate as EndDate
from [table]
where CreateDate>@startdate and CreateDate<@enddate
If you still have any question, please feel free to ask.
Best Regards,
Simon Hou

Similar Messages

  • TO STOP WORKFLOW TEMPORORILY for a period of time

    how can i stop running workflow tempororily for a period of time
    for ex: 7 days.
    any one pls answer this,its urgent
    if not pls send any links regarding this topic...

    hi  krishna,
    thanks for u  r reply,
    i created custom function module z*********.
    in swe2 for check FM text box i  assigned that fn module
    In workflow builder start conditions
    when click on that start conditions pop screen is appeared
    to choose any one.
    for the current scenario
    --which option i have to choose when i click on start conditions button .
    --i have created date attribute in object type,In function module how can i access object attribute to write a condition in function module.
    --can u send me the logic please.

  • Screen freezes randomly for short periods of time [Solved]

    I'm not sure when this started to happen, but my screen will freeze (not refresh) randomly for short periods of time (about 5 seconds). The mouse cursor still active and anything I click on will eventually catch up once the screen refreshes.
    I'm assuming this is an Xorg issue, or perhaps and Nvidia issue, but here are some details:
    KDE 4.4
    Kernel 2.6.32-ARCH 64
    Nvidia 195.36.15
    And here is my Xorg.conf:
    # nvidia-xconfig: X configuration file generated by nvidia-xconfig
    # nvidia-xconfig: version 1.0 (buildmeister@builder58) Tue Oct 20 21:25:04 PDT 2009
    Section "ServerLayout"
    Identifier "Layout0"
    Screen 0 "Screen0" 0 0
    InputDevice "Keyboard0" "CoreKeyboard"
    InputDevice "Mouse0" "CorePointer"
    InputDevice "SynapticsTouchpad" "SendCoreEvents"
    EndSection
    Section "Files"
    EndSection
    Section "Module"
    Load "glx"
    Load "synaptics"
    EndSection
    Section "InputDevice"
    # generated from default
    Identifier "Mouse0"
    Driver "mouse"
    Option "Protocol" "auto"
    Option "Device" "/dev/psaux"
    Option "Emulate3Buttons" "no"
    Option "ZAxisMapping" "4 5"
    EndSection
    Section "InputDevice"
    # generated from default
    Identifier "Keyboard0"
    Driver "kbd"
    EndSection
    Section "InputDevice"
    Identifier "SynapticsTouchpad"
    Driver "synaptics"
    Option "AlwaysCore" "true"
    Option "/dev/input/mice"
    Option "/dev/psaux"
    Option "VerticalEdgeScroll" "True"
    Option "HorizontalEdgeScroll" "True"
    Option "CornerCoasting" "true"
    Option "TapButton1" "1"
    Option "TapButton2" "2"
    EndSection
    Section "Monitor"
    Identifier "Monitor0"
    VendorName "Unknown"
    ModelName "Unknown"
    HorizSync 28.0 - 33.0
    VertRefresh 43.0 - 72.0
    Option "DPMS"
    EndSection
    Section "Device"
    Identifier "Device0"
    Driver "nvidia"
    VendorName "NVIDIA Corporation"
    EndSection
    Section "Screen"
    Identifier "Screen0"
    Device "Device0"
    Monitor "Monitor0"
    DefaultDepth 24
    Option "NoLogo" "True"
    Option "RenderAccel" "True"
    Option "TripleBuffer" "True"
    Option "BackingStore" "True"
    SubSection "Display"
    Depth 24
    EndSubSection
    EndSection
    Needless to say this is very annoying/embarrassing when I try and show people stuff, so any help would be greatly appreciated!
    Last edited by fini_fly (2010-05-21 13:47:20)

    What you can try is to add:
    option "UseEvents" "false"
    (also try "true" and see if it works for you)
    to your xorg.conf under the device section. Play with both false and true settings, UseEvents is somewhat related to the short freezes and the nvidia guys mentioned they disabled this feature a few driver releases ago (as far as i know from researching their forums). Otherwise we probably have to wait for a new driver series.
    Another tweak would be to check if you use MSI for your nvidia card:
    cat /proc/interrupts:
    22: 0 4 1106 297835 IO-APIC-fasteoi ohci_hcd:usb3
    23: 1 17 3275 890447 IO-APIC-fasteoi hda_intel
    27: 2 13 1035 342106 PCI-MSI-edge ahci
    28: 5 337 26356 7568321 PCI-MSI-edge eth0
    29: 6 92 10219 1998835 PCI-MSI-edge nvidia
    NMI: 0 0 0 0 Non-maskable interrupts
    add this to /etc/modprobe.d/options.conf: (does not work with all nvidia cards but i can confirm it works with the 200 series)
    options nvidia NVreg_EnableMSI=1
    While using MSI slightly improves performance some people reported it also shortens the occasional freezes.
    As said in the post above this is only for nvidia and it may or may not help for some gpu's.
    Best regards

  • How to block internet connection for a period of time?

    Hey guys is there a way to block internet connection via a lan connection for a period of time? A program that when my pc is boot up it run secretly and at the time schedule it block the internet connection with no pop up. When i not at home some person
    used my pc to use my internet connection everyday. I can't lock up my pc since my brother or my dad used it.
     

    Hi,
    You could create a schedule task to achieve this.
    The detailed solution please refer to this thread:
    https://social.technet.microsoft.com/Forums/en-US/7544cbed-507d-4eef-907d-bafb99b45411/disable-internet-for-a-set-period-of-time?forum=w7itprogeneral
    Karen Hu
    TechNet Community Support

  • 4 albums purchased from iTunes yesterday have songs not playing all the way through. They play for a period of time and skip to the next song. Everytime they are played. Can anyone help?

    Some songs I purchased last night are not playing all the way through. Several songs from the 4 albums I purchased play for a period of time then just skip to the next song. The songs that do this, do it everytime they are played at the exact same spot. The songs that are affected skip to the next on iTunes on my PC which is updated to the most current iTunes and my 160gb iPod classic. Everytime they are played at the exact same spot. However on my other device, iPhone 4s all songs play just fine. I have almost 7,000 songs on my iPod and this has never happened before and I have played it awhile since downloading those albums yesterday. This is only happening with the albums purchased yesterday. Can anyone help me figure out what is wrong?

    I'm having the same issue with a few songs I just downloaded. It skips randomly in the middle of the song.

  • For OS X: Whenever I have internet access my disk is running continuously for a period of time without any activity on my part.  When I close internet access the disk activity stops.  Who is fishing for data?

    For OS X v5 or 6: Whenever I have internet access my disk is running continuously for a period of time without any activity on my part.  When I close internet access the disk activity stops.  Who is fishing for data?

    Thanks for your reply.  I don't use itunes so that couldn't be it.  Reading about Little Snitch and Hands Off, however,  educated me about the data harvesting in many apps and that when buying from the AppStore one will more likely get Apps with benign data harvesting.

  • Im on wifi but sometimes when i try and send imessages it wont let me for a period of time why?

    Im on wifi but sometimes when i try and send imessages it wont let me for a period of time why?

    If not thsi:
    iOS: Wi-Fi or Bluetooth settings grayed out or dim
    One user reported that placing the iPod in the freezer fixed the problem. A trick that works frequently with iPhones:
    Settings > AirPlane Mode ON, Do Not Disturb ON
    Power down and wait 5-10 minutes
    Power up
    Settings > AirPlane Mode OFF, Do Not Disturb OFF
    If not successful, an appointment at the Genius Bar of an Apple store is usually in order.
    Apple Retail Store - Genius Bar
    Then
    Does the iOS device connect to other networks? If yes that tend to indicate a problem with your network.
    Does the iOS device see the network?
    Any error messages?
    Do other devices now connect?
    Did the iOS device connect before?
    Try the following to rule out a software problem:                
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Power off and then back on your router
    .- Reset network settings: Settings>General>Reset>Reset Network Settings
    - iOS: Troubleshooting Wi-Fi networks and connections
    - Wi-Fi: Unable to connect to an 802.11n Wi-Fi network      
    - iOS: Recommended settings for Wi-Fi routers and access points
    - Restore from backup. See:
    iOS: How to back up
    - Restore to factory settings/new iOS device.
    If still problem and it does not connect to any networks make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar

  • Ignore user imput for a period of time

    Hi there
    Was wondering whether anybody could answer this question;
    Is there a way to tell Director to ignore all mouse clicks
    for a period of time?
    I am swinging a qtvr sprite with various commands attached to
    the swing action, including a timer.
    In order for this to work out the user should not be able to
    interfer with the swing action once it is in motion. They should
    only regain control once the swing is complete and the commands
    have been carried out.
    Is this possible??
    Thankee kindly...

    I think the simple but dirty trick, placing a transparant on
    top of your
    sprite/stage (rectangle form the tools menu, with no border),
    will work.
    Attach behaviour with empty mouseUp and mouseDown to the
    transparant, so
    mouseactions do not pass, like:
    on mouseUp me
    end
    on mouseDown me
    end
    Move the transparant in/out when needed

  • Having program wait for a period of time

    I have a program that I am creating that will need to paint something to the panel every few seconds. I have some code like so:
    public void paintBar(Graphics g, Graphics2D g2)
              for(int i = 0; i < 325; i++)
                   //draw a rectangle
                   double leftX = 36;
                   double topY = 76;
                   double width = i;
                   double height = 48;
                   double test = 100;
                   Rectangle2D rect = new Rectangle2D.Double(leftX, topY, width, height);
                   g2.setPaint(Color.yellow);
                   g2.fill(rect); //fill rectangle with color
                   g2.setPaint(new Color(204, 204, 153)); //change paint to background color for erase
                   eraseMessage(g);
                   calculatePercentage(i);
                   g2.setPaint(Color.black); //change paint color back to black for message
                   printMessage(g);
    //NEED TO WAIT HERE FOR A PERIOD OF TIME
    //THEN CONTINUE WITH LOOP.
    The problem that I am having is that I tried to use different wait() meathods and it seems to get to the wait meathod and just freeze. The painting is never done until the wait command is complete and then the all of the painting is totally finished. I never see it progressing.
    Any ideas?
    Thanks

    You could use a scheduled event...
    public void run() {
         Timer timer = new Timer(false);          // Create Timer
         class Refresh extends java.util.TimerTask {     
              // Create repaint event
              public void run(){repaint();}
         timer.schedule(new Refresh(),0,10);     // Schedule repaint
    }Call this when you run your program, and place all your paint and update methods into a paint(graphics g) method.
    Then, the timer will continuously run repaint repeatedly.
    You can then insert a single event timer (i don't know how off hand, but they are in the API under Timer events), that kills the origional event timer after X ammount of time.

  • My wifi button is frezon and I tried turning my phone off for a period of time and reset my phone but the button is still frezon it want slide over to turn on my wifi. Is there any other way to fix without going to apple to get it fixed?

    My wifi button is frezon and I tried turning my phone off for a period of time and reset my phone but the button is still frezon it want slide over to turn on my wifi. Is there any other way to fix without going to apple to get it fixed?

    Hey Posada143, You can still try the rice thing, but do not expect much, as roaminggnome has stated. The rice only works if you do it ASAP and leave the iPod off-- do not attempt use, turn on or charge until it is completely dried out. This is probably academic at this point but remember this for the next time: The drying can take 10 days. You put the uncooked rice and iPod in a sealed bag, change the rice every couple of days. This creates a low humidity environment and draws the moisture out of the iPod, but it takes time. Turn your iPod on to earlier, and you run the risk of shorting out, damaging the components inside. Even if done correctly it can spotty. If you do get the iPod to work (and this may require Resetting, Restoring or attempting to place it in DFU recover mode) the first thing you do is make backups, because you never know how long it will continue to work. As for your pictures, if you can't get your iPod to work, you can try data retrieval companies, however; there is no guaranty it will work and it tends to be very expensive. In the future get in the habit of as making backups, because you just don't know. And invest in and use a water tight case. Hope this helps, Good luck. Cheers.

  • After using my browser (any of them) for a period of time I get a message saying that a page can't be opened. I have to reboot again. Clearing the cache doesn't help.

    After using my browser (any of them) for a period of time I get a message saying that a page can't be opened. I have to reboot again. Clearing the cache doesn't help. It's very annoying. It even happened in the middle of a chat with Apple online support. I'd be very grateful for help!

    Several things come to mind ... when you say your wife uses the same system with a different login and doesn't have issues, that suggests looking at your login items. Go to System Preferences (on your dock or on your hard drive in Applications), accounts, and on your account look at login items. Anything there that shouldn't be or isn't used? If you don't know, create a new account for yourself with no login items, and see if you still have the issue.
    Next, I would run OnyX, which is a free disk maintenance program. You can download it from http://www.titanium.free.fr/download.php . Do the tasks on the cleaning and maintenance tabs. Before using any disk maintenance software, you should have a system backup. I periodically run it, and others have found that it can help with performance.
    You might look at how you're system is using memory. You should have enough but it's easy to check. Bring up the Activity Monitor (on your hard drive in Applications/Utilities), and look at the system memory tab. Note page ins and page outs. If page outs are 10% to 15% more than page ins, you can use more memory for the programs you run. A page out occurs when memory is full and OS X has to write a section of memory to the hard drive. Too much of this can really impact performance. The optimal situation is for page outs to be zero.  Note these  values reset on a system boot.

  • Possible loop deadline monitoring for a period of time?

    Hi All,
    Here is our scenario.. We have a task sent to the managers inbox with deadline monitoring on it.  If the manager does not action this task, we set this task to obsolete and then we want to send a reminder email every day until the manager performs the required action.
    So the problem.. originally this email was to be a task but the loop would not work with the task as it's waiting on action from the user.  We changed this task to an email and it looped as expected however the only way I could think to put a wait for a period of time before another email is sent is by actually counting down the time in a method.
    However, the problem with this is that wf-batch is locking the worklfow so it can never complete, even if the event to complete the workflow is triggered.  wf-batch has it locked so the workflow can never complete, so it loops infinitely.
    So my question.. is it possible to repeatedly send notifications to a manager at specifically defined time intervals without locking the workflow?
    Below is how the workflow currently looks:
    Any guidance on this would be most gratefully received!
    Thanks in advance,
    Liz.

    Hi Liz
    in your wait step, do not count down the time.
    Instead keep the method as a dummy method with no code.
    In the wait step, use the deadline monitoring - Requested Start - set it to current date + 1 day
    The step will start 1 day after 'today' , execute nothing in Dummy method and then go on to the mail step
    I am sure that the deadline monitoring job is running because "Latest End" of the first task is executed in your system. So the same job will take care of Requested Start of the wait step.
    regards,
    Modak

  • Firefox crashes when it is open for a period of time telling me plugin container for Firefox has stopped working.

    I have Windows Vista with Firefox. When on-line for a period of time Firefox crashes and tells me plugin container for Firefox has stopped working.

    See http://kb.mozillazine.org/Plugin-container_and_out-of-process_plugins

  • To display splash screen for certian period of time using threads

    i want to write a program to display splash screen for certian period of time using threads. could some one help me

    If you just want a splash screen: [http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/|http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/]
    If you want to learn threads: [http://java.sun.com/docs/books/tutorial/essential/concurrency/|http://java.sun.com/docs/books/tutorial/essential/concurrency/]

  • Hello. How can I make it so firefox remembers which links I've visited as on the music singles pages for longer periods of time and more links?

    I frequently use the singles pages on wikipedia, for example: http://en.wikipedia.org/w/index.php?title=Category:2012_singles&from=D
    So I had already clicked on the links some months ago on the 2012 singles pages, but firefox forgot that I had clicked on the links there. How can I make it so it remembers for longer periods of time without causing problems to firefox? Also, I want it to remember what links I've clicked on the 2013 singles pages, because I am also keeping up with that. Can I tell firefox to remember all history for these pages, such as 2012 singles, or 2013 singles specifically? I just want firefox to remember what links I've visited, as in, the songs in the 2012/2013 singles pages, and not forget those, because I have already downloaded those so I want firefox to keep track. What are my options? Please let me know, and I hope you understand the problem I am describing.

    My Firefox remembers history from over a year ago, and unless you are using a setting or external tool to clear it, or load huge numbers of pages/download huge numbers of files, Firefox should pretty easily remember links you've accessed in recent months.
    To see what Firefox has computed as the number of URLs to remember, you can check here:
    (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (2) In the filter box, type or paste '''.hist''' and pause while the list is filtered
    (3) Look for '''places.history.expiration.transient_current_max_pages'''
    Mine's set to 104858. I don't know how that was determined.

Maybe you are looking for