sanyada185 Outstanding Contributor.
Outstanding Contributor.
974 views

View for incidents which are logged in previous business day (As per workshift).

Dear Experts,

I have a requirement to create a View of incidents which shows incidents logged in previous business day. Means if he generates report on Monday, he should get all incidents logged on Friday. This report also should take into account public holidays, basically it should refer to calendar (workshift) and give the list of incidents logged only during the workshift.

Kindly suggest how to achieve same. Appreciate your quick suggestions/workaround.

Regards,
Sanjay Yadav
Assign Kudo, if found post useful and mark it accepted if solves the issue.
0 Likes
8 Replies
ALARMus Acclaimed Contributor.
Acclaimed Contributor.

Re: View for incidents which are logged in previous business day (As per workshift).

the first thing that comes to mind.

create new filed in incident (my.next.workday for example) to store there date format data.

when the incident is created put in this new field date next for current using calendar (like SLA calculate it)

And then use View where query is my.next.workday same as current.

0 Likes
Highlighted
sanyada185 Outstanding Contributor.
Outstanding Contributor.

Re: View for incidents which are logged in previous business day (As per workshift).

HI,

Thanks, but new filed will have a restriction on existing tickets... i was thinking of creating a script to filter based upon open.time filed of incidents and then query them using calendar.calc.date RAD function using workshift...but not getting any luck...

using below script but its resulting all the incidents, but i want to get tickets which are logged during the workshift, say only tickets logged from Monday to Friday (all tickets logged on Satruday and Sunday and holiday should not appear).

function incidentsList(paramDate) {

var date = system.functions.val(paramDate,2);

var file = new SCFile('incidents');

var ret = [];

var sDate = function (time) { return getDate(time, '00:00:01' , 'UAE/Dubai', 'day')};//your tz and calendar goes here

var cuttedDate = function (date) { return system.functions.val(date,2).substring(0,8)};

var rc = file.doSelect('open.time>\''+date+'\'');

while (0==rc) {

if (cuttedDate(sDate(file['open.time'])) != cuttedDate(file['open.time'])) ret.push(file['incident.id']);
//if (cuttedDate(sDate(file['open.time'])) == cuttedDate(file['open.time'])) ret.push(file['incident.id']);

rc = file.getNext();

}

return ret;
}

function getDate(startDate,interval,timezone,duty)
{
var radResults = system.library.RAD.run("calendar.calc.date",

new SCDatum(['times,1','times,2','prompt','name','times,3']),

new SCDatum([startDate,interval,duty,timezone]),

new SCDatum([3,3,2,2,3]),

new SCDatum(['times,3']))

return (radResults.results!=null) ? '':radResults.results[0];
}

 

Regards,
Sanjay Yadav
Assign Kudo, if found post useful and mark it accepted if solves the issue.
Tags (1)
ALARMus Acclaimed Contributor.
Acclaimed Contributor.

Re: View for incidents which are logged in previous business day (As per workshift).

Your function (just it's easy to read it):

function incidentsList(paramDate) 
{
var date = system.functions.val(paramDate,2);
var file = new SCFile('incidents');
var ret = [];
var sDate = function (time) { return getDate(time, '00:00:01' , 'UAE/Dubai', 'day')};//your tz and calendar goes here
var cuttedDate = function (date) { return system.functions.val(date,2).substring(0,8)};
var rc = file.doSelect('open.time>\''+date+'\'');

while (0==rc)
{
if (cuttedDate(sDate(file['open.time'])) != cuttedDate(file['open.time'])) ret.push(file['incident.id']);
//if (cuttedDate(sDate(file['open.time'])) == cuttedDate(file['open.time'])) ret.push(file['incident.id']);
rc = file.getNext();
}
return ret;
}

function getDate(startDate,interval,timezone,duty)
{
var radResults = system.library.RAD.run("calendar.calc.date",
new SCDatum(['times,1','times,2','prompt','name','times,3']),
new SCDatum([startDate,interval,duty,timezone]),
new SCDatum([3,3,2,2,3]),
new SCDatum(['times,3']))
return (radResults.results!=null) ? '':radResults.results[0];
}

 

 

 So as i understand your want have ability to select any time interval measured in working days only.

Do you need only get list of interactions id ? or you need make some VIEW for interaction ?

0 Likes
sanyada185 Outstanding Contributor.
Outstanding Contributor.

Re: View for incidents which are logged in previous business day (As per workshift).

Hi,

We want to create a view to show all interaction which are opened only on weekdays (as per the workshift defined, excluding the one opened on holidays).

Appreciate your support.

Regards,
Sanjay Yadav
Assign Kudo, if found post useful and mark it accepted if solves the issue.
0 Likes
ALARMus Acclaimed Contributor.
Acclaimed Contributor.

Re: View for incidents which are logged in previous business day (As per workshift).

So you just need to set into new field in interaction (for example my.day.week) the digit - indicating each day of the week and use FC or trigger to do it.

Use this function:

RAD function: dayofweek
A RAD function that returns the day of the week for a date, regardless of the date format. The
dayofweek function returns 1-7, where 1 is Monday, 2 is Tuesday, 3 is Wednesday, 4 is Thursday,
5 is Friday, 6 is Saturday, and 7 is Sunday.


Function
dayofweek

Format
day=dayofweek($date)

Where the value of $date is a date and time value.

Factors
The set.timezone function affects the way a date is presented, whereas the dayofweek function
always extracts the proper day of week value.

Examples
From the RAD debugger type:

d dayofweek(‘11/06/09’)

This expression displays the day of the week of a specific date. (The command ’d’ stands for
’display.’) In this example, the value of dayofweek is 5 or Friday.
From the RAD debugger type:
x $Ltoday=dayofweek(‘11/06/09’)
This expression executes the function. (The command ’x’ stands for ’execute.’) In this example,
you want to assign the value to a variable.

0 Likes
sanyada185 Outstanding Contributor.
Outstanding Contributor.

Re: View for incidents which are logged in previous business day (As per workshift).

Hi,

Thanks, but how can i use same to create a view to show only calls which are opened during the workshift (exculding holiday tickets).

Regards,
Sanjay Yadav
Assign Kudo, if found post useful and mark it accepted if solves the issue.
0 Likes
ALARMus Acclaimed Contributor.
Acclaimed Contributor.

Re: View for incidents which are logged in previous business day (As per workshift).

my.day.week not equal 6 and my.day.week not equal 7

it take account only the weekend (Saturday and Sunday) and does not take account public holidays.

 

0 Likes
Outstanding Contributor.. exeptt Outstanding Contributor..
Outstanding Contributor..

Re: View for incidents which are logged in previous business day (As per workshift).

HI @sanyada185 

Could you share your view query?  

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.