Highlighted
Absent Member.
Absent Member.
3212 views

How to use date(tod()) function for queries?

Jump to solution

We have to do a lot of queries every (late) evening. So I would like to speed it up with favourites.

 

The first query is to ask for all incidents which came up over the day.

 

When I save it and move it to the menue "Favourites and Dasboards", the query looked at 17:49:22 like:

Query: security.id#"MD000069" and open.time>='16/10/15 00:00:00'

and

Normalized query: security.id#"MD000069" and open.time>=tod() - '17:49:22'

 

But it is NOT the same like:

security.id#"MD000069" and open.time>=date(tod())

 

I do not understand this, because date(tod()) should be the beginning of today.

 

How will I have to change the query so that I can use it every day?

 

 

Second problem:

We would like to find out how much/ which incidents were resolved between yesterday 19:00 and today 19:00 (=07:00 PM)

SM9 generates at 06:02PM:

query: security.id#"MD000069" and (resolved.time>='15/10/15 19:00:00' and resolved.time<='16/10/15 19:00:00') Normalized query: security.id#"MD000069" and (resolved.time>=tod() - '23:02:23' and resolved.time<=tod() + '00:57:37')

 

I tried to convert it for everydays use

security.id#"MD000069" and (resolved.date>=date(tod() - '05:00:00') and resolved.date<=date(tod() + '19:00:00')

but this is totally wrong (Invalid syntax for query.Failed parsing (display.show.rio).

 

How would it be correct?

Where can I find some informations about the parameters of tod() or date(tod())?

 

 

HP Service Manager-Client Version 7.11.655 P21

HP Service Manager-Server Release 9.34.4014 Build P4HF6

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

Re: How to use date(tod()) function for queries?

Jump to solution

security.id#"MD000069" and open.time>=date(tod())

Means: Show all Tickets from customer MD000069 opened today since 00:00:00

 

This works, if nobody changes the data in the background...

 

---

 

security.id#"MD000069" and resolved.time>=date(tod())-'1 00:00:00'+'19:00:00' and resolved.time<=date(tod()) + '19:00:00'

Means: Show all Tickets from customer MD000069 which were resolved between yesterday (>=date(tod())-'1 00:00:00) 07:00PM (+'19:00:00') and today (<=date(tod())) 07:00PM (+ '19:00:00')

 

This works too.

 

Maybe it helps somebody else.

View solution in original post

0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

Re: How to use date(tod()) function for queries?

Jump to solution

security.id#"MD000069" and open.time>=date(tod())

Means: Show all Tickets from customer MD000069 opened today since 00:00:00

 

This works, if nobody changes the data in the background...

 

---

 

security.id#"MD000069" and resolved.time>=date(tod())-'1 00:00:00'+'19:00:00' and resolved.time<=date(tod()) + '19:00:00'

Means: Show all Tickets from customer MD000069 which were resolved between yesterday (>=date(tod())-'1 00:00:00) 07:00PM (+'19:00:00') and today (<=date(tod())) 07:00PM (+ '19:00:00')

 

This works too.

 

Maybe it helps somebody else.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.