/build/static/layout/Breadcrumb_cap_w.png

K1000 Reporting - Help with a custom report

Guys

 

I've created a custom report for our workstations and last shutdown time. The report is pulling back all the infromation I need , however , I want to open pull back workstations that have a shutdown time greater than 7 days when the report is run.

Here's my report syntax.

 

select LABEL.NAME as LABEL_NAME, MACHINE.NAME as MACHINE_NAME, MACHINE.USER_LOGGED as USER_LOGGED
, ORG1.MACHINE.ID
, LAST_ShUTDOWN

from ORG1.MACHINE
left outer join ORG1.MACHINE_LABEL_JT on MACHINE.ID = MACHINE_LABEL_JT.MACHINE_ID
left outer join ORG1.LABEL on MACHINE_LABEL_JT.LABEL_ID = LABEL.ID
where LABEL.TYPE !='hidden' and LABEL.NAME = 'M_Desktop' or LABEL.NAME = 'M_Laptop'

 

I'm looking to add some line to open pull back machines with a greater shutdown that 7 days. Anybody provide any help?

 


2 Comments   [ + ] Show comments
  • Thanks Grayematter
    Im not sure it's worked fully , as I can see machines with shutdown times for today and yesterday but the report it only pulling back 87 machines (without the line you gave me it was 148) - FergieMan 9 years ago
  • I would add some parentheses to remove any possible ambiguity, like:
    where
    LABEL.TYPE !='hidden'
    and
    (LABEL.NAME = 'M_Desktop' or LABEL.NAME = 'M_Laptop')
    and
    LAST_SHUTDOWN < date_sub(now(), interval 7 day) - grayematter 9 years ago

Answers (2)

Posted by: grayematter 9 years ago
5th Degree Black Belt
0

Add the following line to the where clause of your query:

and LAST_SHUTDOWN < date_sub(now(), interval 7 day)

This should pull those records with LAST_SHUTDOWN timestamps before 7 days ago.

 

Posted by: FergieMan 9 years ago
Third Degree Green Belt
0

That's worked Graymatter. A few brackets sorted it out. Sweet. 

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ