04-29-2014 02:20 PM
I am trying to create a report definition from scratch using Agent, Agent_Logout, Agent_Interval & Agent Half_Hour tables.
it is a simple report and have been able to create the report definition, however when I run the report for a given date, when I know there is data then I do not get any records come back
Here is the query.
Anyone with any ideas?
SELECT
Agent.EnterpriseName as AgentName,
Agent_Logout.LogoutDateTime,
Agent_Logout.LoginDuration,
Agent_Logout.Extension,
Agent_Logout.ReasonCode,
Agent.SkillTargetID,
Agent_Half_Hour.DateTime,
Agent_Half_Hour.TimeZone,
Agent_Interval.LoggedOnTime
FROM
Agent_Logout
JOIN Agent ON Agent_Logout.SkillTargetID = Agent.SkillTargetID
JOIN Agent_Half_Hour ON Agent_Half_Hour.SkillTargetID = Agent_Logout.SkillTargetID
JOIN Agent_Interval ON Agent_Interval.SkillTargetID = Agent_Half_Hour.SkillTargetID
WHERE Agent.EnterpriseName
IS NOT NULL ORDER BY Agent.EnterpriseName ASC
Solved! Go to Solution.
04-30-2014 07:03 AM
How are your filter fields built? Or are you just filtering on Agent_Half_Hour.DateTime? Agent_Interval.LoggedOnTime likely won't give you much. I just ran the query directly in SQL management studio and it works fine against the AWDB. LogoutDateTime would probably work well as a filter here.
Also, a couple things you should consider to improve the SQL used here...
So, based on the above, a better query may be something like:
SELECT
A.EnterpriseName as AgentName,
AL.LogoutDateTime,
AL.LoginDuration,
AL.Extension,
AL.ReasonCode,
DATEADD(s,-(AL.LoginDuration),AL.LogoutDateTime) AS LoginDateTime,
A.SkillTargetID
FROM
Agent_Logout AL
JOIN Agent A ON AL.SkillTargetID = A.SkillTargetID
Of course add in any appropriate WHERE, ORDER BY, etc. I would use either LogoutDateTime or LoginDateTime as your time filter, and SkillTargetID as your agent filter.
04-30-2014 07:03 AM
How are your filter fields built? Or are you just filtering on Agent_Half_Hour.DateTime? Agent_Interval.LoggedOnTime likely won't give you much. I just ran the query directly in SQL management studio and it works fine against the AWDB. LogoutDateTime would probably work well as a filter here.
Also, a couple things you should consider to improve the SQL used here...
So, based on the above, a better query may be something like:
SELECT
A.EnterpriseName as AgentName,
AL.LogoutDateTime,
AL.LoginDuration,
AL.Extension,
AL.ReasonCode,
DATEADD(s,-(AL.LoginDuration),AL.LogoutDateTime) AS LoginDateTime,
A.SkillTargetID
FROM
Agent_Logout AL
JOIN Agent A ON AL.SkillTargetID = A.SkillTargetID
Of course add in any appropriate WHERE, ORDER BY, etc. I would use either LogoutDateTime or LoginDateTime as your time filter, and SkillTargetID as your agent filter.
08-08-2018 11:14 PM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide