You can get log records from the TB_EVENT_LOG table. Every log coming from Suprema readers is stored in the table. The description for the TB_EVENT_LOG table is as follows:

TB_EVENT_LOG

Idn Name Type Size Key Index Default Description
1nEventLogIdn Integer 4 Event Index - nEventIdn od TB_EVENT
2nDateTime Integer 4 PK O Event Time in UTC ex> 33435
3nReaderIdn Integer 4 PK O Reader Index - nReaderIdn's TB_READER
4nEventIdn Integer 4 PK O TB_EVENT's nEventIdn
5nUserID Integer 4 PK O User ID - sUserID of TB_USER
6nIsLog Smallnt2 It is Log or Real Time Data
7nTNAEvent Smallnt 2 T&A Event
8nIsUseTA Smallnt 2 Check if used for T&A result
9nType Smallnt 2 Log type: Normal(0), Image log(1), Avi log(2)

You can get the date and time of an event from the nDateTime field of the table. The nDateTime field indicates the number of seconds that have elapsed since January 1, 1970. So, if you want to get log records for user ID 50017 that happened between January 1, 2010 and July 1, 2014, you can execute the query below:

SELECT *
    FROM [BioStar].[dbo].[TB_EVENT_LOG]
    WHERE nDateTime > datediff(SECOND, '19700101 00:00:00', '20100101 00:00:00') AND nDateTime < datediff(SECOND, '19700101 00:00:00', '20140701 00:00:00') AND nUserID = 50017;

nUserID (50017) in this SQL statement is ID on BioStar Client.


If you want to know the type of a log record, you need to take a look at the nEventIdn column. For example, in the screenshot below, the value for the nEventIdn column is 119.


You can execute the following query to get the type of an event:

SELECT [nEventIdn]
    ,[sName]
    ,[sDescription]
FROM [BioStar].[dbo].[TB_EVENT_DATA]
WHERE nEventIdn = 119;



If you want to know if an event is coming from an in device or an out device, you need to refer to the TB_DOOR_READER table. The nReaderIdn field of the TB_USER_EVENT indicates from which device an event came. Using nReaderIdn field, you can tell whether the device is in device or out device.

As shown in the figure below, there are columns named nReaderIdn and nInout. The value of nReaderIdn in TB_DOOR_READER is identical to the one in TB_EVENT_LOG. In the nInout field, the value 1 indicates “Inside Device” and the value 2 indicates “Outside Device”.


If you use one device for checking in and out of employees and use T&A keys, you can tell whether a log record is an in-event or an out-event by taking a look at the nTNAEvent column of the TB_EVENT_LOG table. For example, if you use BioStation, there are four T&A keys on the device: F1, F2, F3 and F4. The value 0 in the nTNAEvent column indicates that an employee presses T&A key F1. The value 1 indicates F2, 2 indicates F3, and 3 indicates F4.

There is no such field (FLAG) which tells you whether the database has been updated after pulling data from the BioStar database. You need to take a look at records in the TB_EVENT_LOG table to determine whether there are any newly added log records. You can determine if there are any newly added log records by comparing the latest time of the log records and the time you have previously stored. However, there would be millions of log records when there are many devices with many employees at your customer’s site, so querying the log table repeatedly may cause an unexpected effect on the overall performance of BioStar.

See Also