Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..
188 views

How to get end last month report from Service manager

Jump to solution

Hello

What is the query if I need to return the "Last Full Month" records?
Let's say we are in Febuary & I want to pull all the data from January?
Thanks

0 Likes
1 Solution

Accepted Solutions
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: How to get end last month report from Service manager

Jump to solution
hello,
you can use this query for example if it's based on the open.time field:
(month(open.time)=month(tod())- 1 and year(open.time)=year(tod()))

View solution in original post

4 Replies
Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..

Re: How to get end last month report from Service manager

Jump to solution
Hi
Please refer to SM programming guide, you can use functions like tod(), month and year.
My idea is to ignore the date and get records with
month of open.time = month of today - 1 month
and check for the year

here is an example:
month(open.time)=month(tod()-'30 00:00:00') and year(open.time)=year(tod()-'30 00:00:00')
please note that for this one, if you are on March 1st, it will return January data because, well -30 days will get you back to Jan not Feb.
you can use this and improve it.
0 Likes
Highlighted
Trusted Contributor.. Trusted Contributor..
Trusted Contributor..

Re: How to get end last month report from Service manager

Jump to solution
fast update:
actually you can do jscall in a report. so here is your solution:
have a script library, for this example "testlib"
get this function inside:
function lastmonth()
{
var dte=new Date();
dte.setMonth(dte.getMonth()-1);
return dte;
}

on your report use this query:

month(open.time)=month(jscall("testlib.lastmonth")) and year(open.time)=year(jscall("testlib.lastmonth"))
0 Likes
Highlighted
Honored Contributor.. Honored Contributor..
Honored Contributor..

Re: How to get end last month report from Service manager

Jump to solution
hello,
you can use this query for example if it's based on the open.time field:
(month(open.time)=month(tod())- 1 and year(open.time)=year(tod()))

View solution in original post

Highlighted
Respected Contributor.
Respected Contributor.

Re: How to get end last month report from Service manager

Jump to solution

You can use the the startofmonth() function. For example, lets say its Feb and you want to display all incidents resolved in the past previous 4 months;you can use this query to display all results for start to end of months for Oct, Nov, Dec, and Jan:

resolved.time>=startofmonth(tod() - '120 00:00:00') and resolved.time<startofmonth(tod())

 

Feel free to include additional conditions to filter out records.

 

Joe

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.