Get agent events for multiple agents

(fnc_all_agents_events_window)

Please see more information, explanations and examples in ‘Audit log’ – see all events for an agent

Object name  fnc_all_agents_events_window
Type Table value function
Description

Delivers the same information as described for function fnc_agent_events_window above, except that it’s delivered for all agents for a specified customer. Except from the @customer_key parameter which replaces the @agent_id parameter, all other parameters are the same – as well as the returned table.

Note: It is very demanding to execute this function (it might take several minutes), so if you have lots of agents, please do not use a longer time period than one  hour. Please use “Get agent events for a single agent (fnc_agent_events_window) instead.

Parameters
Name Datatype Descritpion
@customer_key varchar(100) The customer_key for whom we shall get events for all the agents.
@dte_from datetime See fnc_agent_events_window.
@dte_to datetime See fnc_agent_events_window.
@mode int See fnc_agent_events_window.
@time_from char(5) See fnc_agent_events_window.
@time_to char(5) See fnc_agent_events_window.
Returns

Returns a table is identical to the one described for fnc_agent_events_window.

Samples

Get the events for all agents for customer 12345 between 08:30 and 16:00 on May 2nd 2016:

select * 
from [dbo].[fnc_all_agents_events_window](
		'12345’,
			'2-may-2016 08:30',
 			'2-may-2016 16:00',
			 1, NULL, NULL)
order by dte_start

This is a more advanced query, where we get the duration for any event, per agent and per day, for all agents for customer 12345 between June 3rd and (up to, not included) June 8th. But only between ’08:00’ and ’16:00’ for each of the days. Also the agents table is joined in order to get agent’s name.

select	a.agent_id, full_name,
	datepart(year,adj_dte_start) YR, 
	datepart(month,adj_dte_start) MNTH, 
	datepart(day,adj_dte_start) [DAY], 
	event_type,
	sum(adj_duration_sec) duration_sec,
	pause_type_name
 from [dbo].[fnc_all_agents_events_window]('12345',
'3-jun-2016', '08-jun-2016', 1,'08:00','16:00') AS events,
 agents a
 where a.agent_id=events.agent_id
 group by a.agent_id, a.full_name, datepart(year,adj_dte_start), datepart(month,adj_dte_start),datepart(day,adj_dte_start),
		event_type, pause_type_name
order by 1,2,3,4,5, pause_type_name

 

Published

Last updated

4
-1