ANSVIS Database Trigger Setup Guide
Overview
The Database Trigger feature in ANSVIS allows users to save trigger events into a database for tracking and analysis. You can configure the system to store event data in either an MS SQL or ODBC-compatible database.
Steps to Configure a Database Trigger:
1. Access the Event Action Configuration
- Navigate to the Event Action Configuration window within the ANSVIS Client.
- From the Event Action Type dropdown menu, select Database. This will enable the database trigger configuration panel.
2. Select the Database Type
In the Database Type section, choose one of the following options:
- MS SQL: If you are using Microsoft SQL Server.
- ODBC: If you are using an ODBC-compatible database system.
3. Enter MS SQL Settings (If MS SQL is Selected)
If you select MS SQL, enter the following information:
- Server: The address or hostname of your MS SQL server.
- Database: The name of the database where events will be stored.
- User: The username to authenticate with the MS SQL server.
- Password: The password associated with the username.
- Table Name: The name of the table where the event data will be inserted.
Ensure that the table exists in your database and is correctly set up to handle the incoming data.
4. Enter ODBC Settings (If ODBC is Selected)
If you select ODBC, enter the following details:
- Data Source Name: The name of the ODBC data source.
- User: The username to authenticate with the ODBC database.
- Password: The password associated with the username.
- Table Name: The name of the table where event data will be stored.
Make sure your ODBC connection is properly configured in your system.
5. Server image location
In the Server Images Location field, you can specify a folder or path where images related to the event are saved. Click the folder icon to browse and select the location.
6. View Table Schema
Once a Table Name is entered, the Table Schema field will display the structure of the table. Ensure the schema matches the data fields required to store the event information.
7. Add Test Record
Click the Add Test Record button to verify that the system can successfully insert data into the selected table. This is useful for confirming that the database connection and table structure are correct.
8. Save Configuration
After entering all the required information, click Save to store the configuration.
The system will now save event triggers to the specified database table.
DB Schema
USE [OD]
GO
/****** Object: Table [dbo].[Triggers] Script Date: 28/10/2024 10:03:29 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Triggers](
[Id] [int] IDENTITY(1,1) NOT NULL,
[DGID] [int] NOT NULL,
[EventIndex] [int] NOT NULL,
[DetectionData] [varchar](max) NULL,
[Created] [datetime] NULL,
CONSTRAINT [PK_Triggers] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
[
{
"DetectionData":[
{
"Name":"DG",
"ModelClassID":{"ModelID":0,"Class":1},
"ModelClassName":{"Model":"","Class":"All"},
"DeploymentGroupID":0,
"DeploymentGroupName":"",
"CameraID":0,
"CameraName":"",
"TrackID":0,
"Detections":[
{
"Time":"1904-01-01T00:00:00.000Z",
"BoundingBox":{"Left":0,"Top":0,"Right":10,"Bottom":10},
"Score":0.95,
"Image":15,
"ModelClassID":{"ModelID":0,"Class":1},
"ModelClassName":{"Model":"","Class":"All"}
}
],
"Result":"",
"ExtraVisionResult":""
}
]
}
]