See ConvSummaryData - Expands all the GUIDs with their lookups
CREATE VIEW vwconvsummarydata AS (
SELECT cs.conversationid,
cs.conversationstartdate,
cs.conversationstartdateltc,
cs.conversationenddate AS convstartdateusrtz,
cs.conversationenddate,
cs.conversationenddateltc,
cs.conversationenddate AS convenddateusrtz,
cs.originaldirection,
cs.firstmediatype,
cs.lastmediatype,
cs.ani,
cs.dnis,
cs.firstagentid,
ud1.name AS firstagentname,
ud1.department AS firstagentdepartment,
ud3.name AS firstagentmanager,
cs.lastagentid,
ud2.name AS lastagentname,
ud2.department AS lastagentdepartment,
ud4.name AS lastagentmanager,
cs.firstqueueid,
qd1.name AS firstqueuename,
cs.lastqueueid,
qd2.name AS lastqueuename,
cs.firstwrapupcode,
wd1.name AS firstwrapname,
cs.lastwrapupcode,
wd2.name AS lastwrapname,
cs.ttalkcomplete,
((cs.ttalkcomplete)::numeric / 86400.00) AS ttalkcompleteday,
1 AS callans,
CASE
WHEN ((cs.ttalkcomplete >= (0)::numeric) AND (cs.ttalkcomplete <= (10)::numeric)) THEN 1
ELSE 0
END AS "000-010",
CASE
WHEN ((cs.ttalkcomplete >= 10.01) AND (cs.ttalkcomplete <= (20)::numeric)) THEN 1
ELSE 0
END AS "010-020",
CASE
WHEN ((cs.ttalkcomplete >= 20.01) AND (cs.ttalkcomplete <= (30)::numeric)) THEN 1
ELSE 0
END AS "020-030",
CASE
WHEN ((cs.ttalkcomplete >= 30.01) AND (cs.ttalkcomplete <= (60)::numeric)) THEN 1
ELSE 0
END AS "030-060",
CASE
WHEN ((cs.ttalkcomplete >= 60.01) AND (cs.ttalkcomplete <= (120)::numeric)) THEN 1
ELSE 0
END AS "060-120",
CASE
WHEN ((cs.ttalkcomplete >= 120.01) AND (cs.ttalkcomplete <= (360)::numeric)) THEN 1
ELSE 0
END AS "120-360",
CASE
WHEN (cs.ttalkcomplete > 360.01) THEN 1
ELSE 0
END AS "360plus",
CASE
WHEN (wd1.name IS NULL) THEN 'System Default'::character varying
ELSE wd2.name
END AS wrapname,
CASE
WHEN ((((cs.originaldirection)::text = 'inbound'::text) AND ((cs.lastdisconnect)::text = 'peer'::text)) OR (((cs.originaldirection)::text = 'outbound'::text) AND ((cs.lastdisconnect)::text = 'peer'::text))) THEN 'Cust Disc'::text
ELSE 'Agt Disc'::text
END AS disccause,
cs.divisionid,
cs.tqueuetime,
((cs.tqueuetime)::numeric / 86400.00) AS tqueuetimeday,
cs.tacw,
(cs.tacw / 86400.00) AS tacwday,
cs.tansweredcount,
cs.tanswered,
(cs.tanswered / 86400.00) AS tansweredday,
cs.tabandonedcount,
((cs.tabandonedcount)::numeric / 86400.00) AS tabandonedcountday,
cs.tresponsecount,
cs.tresponse,
(cs.tresponse / 86400.00) AS tresponseday,
cs.thandlecount,
cs.thandle,
(cs.thandle / 86400.00) AS thandleday,
cs.theldcompletecount,
cs.theldcomplete,
(cs.theldcomplete / 86400.00) AS theldcompleteday,
cs.nconsulttransferred,
cs.nblindtransferred,
cs.lastdisconnect,
cs.lastpurpose,
cs.lastsegmenttime,
((cs.lastsegmenttime)::numeric / 86400.00) AS lastsegmenttimeday,
cs.updated
FROM ((((((((convsummarydata cs
LEFT JOIN userdetails ud1 ON (((ud1.id)::text = (cs.firstagentid)::text)))
LEFT JOIN userdetails ud2 ON (((ud2.id)::text = (cs.lastagentid)::text)))
LEFT JOIN userdetails ud3 ON (((ud3.id)::text = (ud1.manager)::text)))
LEFT JOIN userdetails ud4 ON (((ud4.id)::text = (ud2.manager)::text)))
LEFT JOIN queuedetails qd1 ON (((qd1.id)::text = (cs.firstqueueid)::text)))
LEFT JOIN queuedetails qd2 ON (((qd2.id)::text = (cs.lastqueueid)::text)))
LEFT JOIN wrapupdetails wd1 ON (((wd1.id)::text = (cs.firstwrapupcode)::text)))
LEFT JOIN wrapupdetails wd2 ON (((wd2.id)::text = (cs.lastwrapupcode)::text)))
)
Name | Type | Default | Nullable | Children | Parents | Comment |
---|---|---|---|---|---|---|
conversationid | varchar(50) | true | Conversation GUID | |||
conversationstartdate | timestamp without time zone | true | Conversation Start Date (UTC) | |||
conversationstartdateltc | timestamp without time zone | true | Conversation Start Date (LTC) | |||
convstartdateusrtz | timestamp without time zone | true | ||||
conversationenddate | timestamp without time zone | true | Conversation End Date (UTC) | |||
conversationenddateltc | timestamp without time zone | true | Conversation End Date (LTC) | |||
convenddateusrtz | timestamp without time zone | true | ||||
originaldirection | varchar(50) | true | Conversation Original Direction | |||
firstmediatype | varchar(50) | true | Conversation First Media Type | |||
lastmediatype | varchar(50) | true | Conversation Final Media Type | |||
ani | varchar(400) | true | Conversation ANI | |||
dnis | varchar(400) | true | Conversation DNIS | |||
firstagentid | varchar(50) | true | Conversation First Agent GUID | |||
firstagentname | varchar(200) | true | Conversation First Agent Name | |||
firstagentdepartment | varchar(200) | true | ||||
firstagentmanager | varchar(200) | true | Conversation First Agent Manager | |||
lastagentid | varchar(50) | true | Conversation Final Agent GUID | |||
lastagentname | varchar(200) | true | Conversation Final Agent Name | |||
lastagentdepartment | varchar(200) | true | ||||
lastagentmanager | varchar(200) | true | Conversation Final Agent Manager | |||
firstqueueid | varchar(50) | true | Conversation First Queue GUID | |||
firstqueuename | varchar(255) | true | Conversation First Queue Name | |||
lastqueueid | varchar(50) | true | Conversation Final Queue GUID | |||
lastqueuename | varchar(255) | true | Conversation Final Queue Name | |||
firstwrapupcode | varchar(255) | true | Conversation First Wrap up GUID | |||
firstwrapname | varchar(255) | true | Conversation First Wrap Name | |||
lastwrapupcode | varchar(255) | true | Conversation Final Wrap Up GUID | |||
lastwrapname | varchar(255) | true | Conversation Final Wrap Up Name | |||
ttalkcomplete | numeric(20,2) | true | Conversation Talk Time (Seconds) | |||
ttalkcompleteday | numeric | true | Conversation Talk Time (Seconds) | |||
callans | integer | true | ||||
000-010 | integer | true | ||||
010-020 | integer | true | ||||
020-030 | integer | true | ||||
030-060 | integer | true | ||||
060-120 | integer | true | ||||
120-360 | integer | true | ||||
360plus | integer | true | ||||
wrapname | varchar | true | ||||
disccause | text | true | ||||
divisionid | varchar(50) | true | ||||
tqueuetime | numeric(20,2) | true | Conversation Queue Time (Seconds) | |||
tqueuetimeday | numeric | true | Conversation Queue Time (Day) | |||
tacw | numeric(20,2) | true | Conversation ACW | |||
tacwday | numeric | true | Conversation ACW in Day | |||
tansweredcount | integer | true | Conversation Total Answered Count | |||
tanswered | numeric(20,2) | true | ||||
tansweredday | numeric | true | Conversation Total Answer Time (Day) | |||
tabandonedcount | integer | true | ||||
tabandonedcountday | numeric | true | ||||
tresponsecount | integer | true | Conversation Total Response Time (Seconds) | |||
tresponse | numeric(20,2) | true | ||||
tresponseday | numeric | true | Conversation Total Response Time (Day) | |||
thandlecount | integer | true | Conversation Total Hold Time (Seconds) | |||
thandle | numeric(20,2) | true | Conversation Total Hold | |||
thandleday | numeric | true | Conversation Total Hold Time (Day) | |||
theldcompletecount | integer | true | Conversation Total | |||
theldcomplete | numeric(20,2) | true | Conversation Total | |||
theldcompleteday | numeric | true | Conversation Total Day | |||
nconsulttransferred | integer | true | Conversation Consult Transfer Count | |||
nblindtransferred | integer | true | Conversation Blind Transfer Count | |||
lastdisconnect | varchar(50) | true | Conversation Last Disconnect Type | |||
lastpurpose | varchar(50) | true | Conversation Last Purpose | |||
lastsegmenttime | numeric(20,2) | true | Conversation Last Segment Total Time (Seconds) | |||
lastsegmenttimeday | numeric | true | Conversation Last Segment Total Time (Day) | |||
updated | timestamp without time zone | true | Date Row Updated (UTC) |
Name | Columns | Comment | Type |
---|---|---|---|
public.convsummarydata | 39 | Conversation Summary Data | BASE TABLE |
public.userdetails | 13 | BASE TABLE | |
public.queuedetails | 17 | Queue Lookup data | BASE TABLE |
public.wrapupdetails | 3 | Wrap Up Code Details Lookup Up Data | BASE TABLE |