See UserPresenceData - Expands all the GUIDs with their lookups
CREATE VIEW vwuserpresencedata AS (
SELECT pd.id,
pd.userid,
ud.name AS agentname,
ud.managerid,
ud.managername,
ud.divisionid,
dd.name AS divisionname,
pd.startdate,
pd.startdateltc,
(pd.startdate + ((( SELECT timezonecalcs.diff
FROM timezonecalcs('Australia/Sydney'::text) timezonecalcs(utctime, ltctime, diff, timezonechosen)))::double precision * '00:00:01'::interval)) AS startdateusrtz,
pd.timetype,
pd.systempresenceid,
pd.presenceid,
CASE pd.timetype
WHEN 'Presence'::text THEN pd.presencetime
ELSE (0)::numeric
END AS presencetime,
(pd.presencetime / 86400.00) AS presencetimeday,
pd.routingid,
CASE pd.timetype
WHEN 'Routing'::text THEN pd.presencetime
ELSE (0)::numeric
END AS routingtime,
(pd.routingtime / 86400.00) AS routingtimeday,
pd.updated
FROM ((userpresencedata pd
LEFT JOIN vwuserdetail ud ON (((ud.id)::text = (pd.userid)::text)))
LEFT JOIN divisiondetails dd ON (((dd.id)::text = (ud.divisionid)::text)))
)
Name | Type | Default | Nullable | Children | Parents | Comment |
---|---|---|---|---|---|---|
id | varchar(50) | true | Primary Key | |||
userid | varchar(50) | true | User GUID | |||
agentname | varchar(200) | true | Agent Name | |||
managerid | varchar(50) | true | Manager GUID | |||
managername | varchar(200) | true | ||||
divisionid | varchar(50) | true | ||||
divisionname | varchar(50) | true | Division Name | |||
startdate | timestamp without time zone | true | Start Date(UTC) | |||
startdateltc | timestamp without time zone | true | Start Date (LTC) | |||
startdateusrtz | timestamp without time zone | true | ||||
timetype | varchar(20) | true | ||||
systempresenceid | varchar(50) | true | System Presence GUID | |||
presenceid | varchar(50) | true | Presence GUID | |||
presencetime | numeric | true | Presence Time | |||
presencetimeday | numeric | true | Presence Time (Days) | |||
routingid | varchar(50) | true | Routing GUID | |||
routingtime | numeric | true | Routing Time | |||
routingtimeday | numeric | true | Routing Time (Days) | |||
updated | timestamp without time zone | true | Last Updated Time |
Name | Columns | Comment | Type |
---|---|---|---|
timezonecalcs | 0 | ||
public.userpresencedata | 12 | BASE TABLE | |
public.vwuserdetail | 17 | See UserDetail: User Description in detail | VIEW |
public.divisiondetails | 4 | BASE TABLE |