Actually it is not working correctly, and I need more help. In added the formulas to the report to see the results.
I've been out for medical reasons and just getting back to this. Screenshot below:
I've tried the formulas different ways, here is what i currently have...
Summee
(select sum(timeatt) subcount -- timeatt defines exit (2) and entry (1)
from reader
JOIN EVENTS a ON READER.READERID = a.DEVID AND READER.PANELID = a.MACHINE -- reader and panel must match
join EMP b on a.EMPID = b.ID)
OnSiteNow
if remainder({%%sumee},2)=1 then
{emp.id} else -- tried cardnum, same difference
Tonumber({@null})
TotalOnsiteNow
"Total On-Site Now: " + ToText(DistinctCount ({@OnSiteNow}), 0)
Tables:
Events -- these are the recordings of the entry and exits
Devid -- the reader fk to Reader
Machine -- the panel that the reader is connected to fk to Reader
Cardnum -- card number fk to Badge
Empid -- employees number fk to Emp
Eventid -- fk to event
DateTime -- when user entered or exited
Event -- defines the event types
evid -- pk
evdesc -- describes the event (access granted or denied)
Emp -- defines the employees
ID -- pk = empid
SSNO -- CardholderId
First name
last name
Badge -- defines the access cards
ID -- pk is the card number
EmpId -- fk to Emp (employee number)
Reader
PanelId -- pk the panel the reader is connected to
ReaderId -- pk the reader
Timeatt -- defines exit (2) and entry (1)
ReaderDesc
Of course there are more fields in these tables, but not really relevant to this.
Thanks again for your help!