Hello again,
You're correct in that timesheets that haven't yet been initiated (by clicking on the clockface) do not yet exist in the database - so they don't have rows in the prtimesheet table in the transactional database, and hence they don't appear in the data warehouse database.
In my system I have 3 timesheets for myself, 2 of which are "open":
In the database though only the final two shown above actually exist:
You'd have to generate the "missing" rows in prtimesheet . I'm sure someone can come up with a better bit of SQL but one way is as follows (where you'd inject the 5003001 value as a parameter in the real world):
select *
from
(
select t.prid timesheet_id, t.prresourceid resource_id, p.prid timeperiod_id from prtimesheet t
join prtimeperiod p on t.prtimeperiodid = p.prid
where t.prresourceid = 5003001
union
select 0, 5003001, p.prid
from prtimeperiod p
where not exists
( select 1 from prtimesheet t
where prresourceid = 5003001
and t.prtimeperiodid = p.prid)
)
where resource_id = 5003001
We now see the missing timesheet too:
Original Message:
Sent: Jun 20, 2022 03:34 AM
From: Sneha Raina
Subject: How to get open timesheet records in data warehouse?
Hello,
We wish to export the resource timesheet data into the data warehouse tables so we can use it for reporting purposes in power BI so we can't write queries to pull data or create views.
Currently we are able to view submitted and posted timesheets for all resources.
We are facing issue wrt the open timesheets. As per my understanding, the Timesheet id gets generated only when the user clicks on current timesheet icon (clock icon on the top right corner). So we have observed discrepancies between data in clarity and dwh tables. All the open timesheets aren't populating in warehouse tables.
Is there a solution to generate timesheet ids for all resources for the current time period. or is there any other table which stores all open timesheet data? We are currently referencing DWH_TME_SHEET, DWH_TME_ENTRY, DWH_TME_ENTRY_FACTS tables
Thanks,
Sneha Raina