4 Replies Latest reply on Jul 12, 2011 6:04 PM by Catalysttgj

    LDMS query filtering on specific time during the current day

    Catalysttgj Expert

      I use this line of code to get this done:

      cast(year(getdate()) as varchar(4)) +'-'+ cast(month(getdate()) as varchar(2)) +'-'+ cast(day(getdate()) as varchar(2)) + ' 05:00:00.000'

       

      Let's say you wanna see only devices that has performed an inventory after 5am of the current day. The above line will do this.

       

      Basically, its just taking the current year, month, and day, and then tacking on the hardcoded hour, minute, second, etc.. desired.

       

      To use, build an LDMS query as you normally would selecting whatever datetime value you want to evaluate

      and insert the line of code in the field instead of a choice from the list. Obviously, you can do greeter, lesser, equal, whatever is needed.

       

      Note: When you're doing a lot of edits on datetime fields, it helps to unselect the "Display scanned values" field, so that it goes faster.

       

      Hopefully, someone finds this useful. I'm not an SQL expert, so there might be a more efficient shorter line that can get this done just as well.

      Anyone?