Data Forwarders
The Data Forwarders feature allows ENVISION to continuously push historical data, alarms, and events to an external database in real time. This is useful for integrating ENVISION with third-party reporting tools, data lakes, ERP systems, or any external SQL database.
Each Data Forwarder runs as an independent background thread, connecting to a remote database on a configurable interval and forwarding records in batches using a watermark-based mechanism โ ensuring no records are skipped or duplicated across restarts.
Supported Databases
|
Database |
Connection Type |
|
SQL Server |
Remote TCP/IP with username & password |
|
MySQL |
Remote TCP/IP with username & password |
|
SQLite |
Local file path |
Managing Data Forwarders
Adding a Data Forwarder
1.
1. Enter a Name and select a Database Type in the add row at the top of the list.
2. Optionally enter a Description.
3. Click Add.
Enabling / Disabling
Use the toggle switch on each row to enable or disable an individual forwarder.
Use the Enable All toggle in the header to enable or disable all forwarders at once. A confirmation dialog will appear.
Selecting & Bulk Actions
Use the checkbox on each row to select individual forwarders.
Use the Select All checkbox in the header to select all visible forwarders.
Export โ exports the selected forwarders to a JSON file.
Delete โ deletes the selected forwarders after confirmation.
Settings
Click the gear icon on a row to open the Settings modal for that forwarder.
Settings
Connection
|
Field |
Description |
|
Verbose |
0 = silent, 1 = connection events, 2 = record counts. |
|
Connection String |
The database connection string. Use the clipboard icon to load a template based on the selected Database Type. |
|
Mode |
Direct Insert โ executes a SQL INSERT. Stored Procedure โ calls a stored procedure. Not supported for SQLite. |
Connection String Templates
|
Database Type |
Template |
|
SQL Server |
Server=myserver;Database=mydb;User Id=myuser;Password=mypassword; |
|
MySQL |
Server=myserver;Database=mydb;Uid=myuser;Pwd=mypassword; |
|
SQLite |
Data Source=C:\path\to\database.db; |
๐ก Connection strings are stored in the ENVISION SQLite configuration database, protected by Windows file system access rights (admin-only).
Forward Data
Forwards records from the HistoricData table.
|
Parameter |
Description |
|
@TimeStamp |
Timestamp of the data record |
|
@Device |
Device name |
|
@Variable |
Variable name |
|
@Value |
Scaled value |
|
@Raw |
Raw value |
|
@Status |
Quality status |
Direct Insert example:
INSERT INTO MyData (ts, dev, var, val, raw, status)
VALUES (@TimeStamp, @Device, @Variable, @Value, @Raw, @Status)
Stored Procedure example (SQL Server):
EXEC sp_InsertData @TimeStamp, @Device, @Variable, @Value, @Raw, @Status
Stored Procedure example (MySQL):
CALL sp_InsertData(@TimeStamp, @Device, @Variable, @Value, @Raw, @Status)
Forward Alarms
Forwards records from the HistoricAlarms table.
|
Parameter |
Description |
|
@AlarmId |
Unique alarm identifier |
|
@OnTime |
Time the alarm became active |
|
@OffTime |
Time the alarm was cleared (nullable) |
|
@Severity |
Alarm severity level |
|
@Asset |
Asset name |
|
@Message |
Alarm message |
|
@Args |
Additional arguments (nullable) |
Direct Insert example:
INSERT INTO MyAlarms (alarmid, ontime, offtime, severity, asset, message, args)
VALUES (@AlarmId, @OnTime, @OffTime, @Severity, @Asset, @Message, @Args)
Forward Events
Forwards records from the HistoricEvents table.
|
Parameter |
Description |
|
@OnTime |
Time of the event |
|
@Asset |
Asset name |
|
@Identity |
Event identity |
|
@Message |
Event message |
|
@Args |
Additional arguments (nullable) |
Direct Insert example:
INSERT INTO MyEvents (ontime, asset, identity, message, args)
VALUES (@OnTime, @Asset, @Identity, @Message, @Args)
Performance
|
Field |
Description |
|
Interval (ms) |
How often the forwarder runs in milliseconds. Default: 5000 (5 seconds). |
|
Batch Size |
Maximum number of records forwarded per cycle. Default: 100. |
Watermarks
ENVISION uses a watermark mechanism to track which records have been forwarded. The last forwarded ID for each data type is stored persistently and survives restarts.
|
Field |
Description |
|
Last Forwarded Data ID |
ID of the last successfully forwarded data record. |
|
Last Forwarded Alarm ID |
ID of the last successfully forwarded alarm record. |
|
Last Forwarded Event ID |
ID of the last successfully forwarded event record. |
๐ก You can manually reset a watermark to 0 to re-forward all records, or set it to a specific ID to resume from a known point.
Runtime Status
Each forwarder row displays its current runtime status and last successful forward timestamp.
|
State |
Description |
|
Stopped |
The forwarder thread is not running. |
|
Starting |
The thread has started and is initializing. |
|
Disabled |
The forwarder is disabled via the Enable toggle. |
|
Connected |
Successfully connected to the remote database. |
|
Forwarding |
Actively sending records to the remote database. |
|
Idle |
Forwarding cycle completed, waiting for next interval. |
|
Error |
An error occurred. Check the event log for details. |
SYSTEM Variables
Each Data Forwarder automatically exposes the following SYSTEM variables, accessible throughout ENVISION (displays, scripts, dashboards):
|
Variable |
Description |
|
{Name}.State |
Current state (see Runtime Status above) |
|
{Name}.LastForward |
Timestamp of last successful forward (yyyy-MM-dd HH:mm:ss) |
|
{Name}.LastForwardedDataId |
Watermark ID for data records |
|
{Name}.LastForwardedAlarmId |
Watermark ID for alarm records |
|
{Name}.LastForwardedEventId |
Watermark ID for event records |
Where {Name} is the name assigned to the forwarder.
Example: A forwarder named PlantSQL exposes PlantSQL.State, PlantSQL.LastForward, etc.
Event Log
Click the speech bubble icon on a row to view the event log for that forwarder. The log records connection events, forwarding activity, and errors, controlled by the Verbose level setting.
Tips & Best Practices
ยท Set Verbose to 1 during initial setup to confirm connectivity, then reduce to 0 in production.
ยท Keep Batch Size between 100โ500 for optimal performance. Very large batches can cause timeouts on slow networks.
ยท Use Stored Procedure mode when the target database has strict schema validation or requires server-side business logic.
ยท For high-frequency data, reduce the Interval to 1000ms or less. For low-priority reporting, 60000ms (1 minute) is sufficient.
ยท If a forwarder shows Error state, check the event log โ the full exception message is recorded there.
ยท Watermarks are safe to reset manually if you need to re-sync historical data to a newly created target database.