Skip to content

Tasks, databases, files

A task runs on the server with no operator involved: counters, schedules, interlocks.

Tasks

Trigger When
Startup Once when the server starts
Interval Every N seconds
Daily At a set time, optionally on chosen weekdays
Tag change On every value change
Condition When a condition becomes true: Level > 9

A condition that is already true when the server starts fires too. It can compare against a number, true/false or another tag’s name. The action is a list of system functions or a script.

The Databases node in the editor describes connections.

Provider Connection string
SQLite A file path relative to the project or Data Source=…, no driver needed
ODBC DSN=Line1 or a full string: SQL Server, PostgreSQL, MySQL, Oracle, Access
var rows = Db.Query("Journal", "SELECT * FROM Events WHERE Id > ?", [100]);
Db.Execute("Journal", "INSERT INTO Events(Time, Text) VALUES(?, ?)", [Server.Now, "Start"]);
var count = Db.Scalar("Journal", "SELECT COUNT(*) FROM Events");

The on-screen Table element shows a query result, and the server runs the query. At most 1000 rows are sent at a time.

Relative paths start at the project folder.

Function Action
File.Exists(path) Whether the file exists
File.ReadText(path) File text
File.ReadLines(path) Array of lines
File.ReadCsv(path, sep) Array of arrays, ; separator by default
File.WriteText(path, text) Write, creating folders
File.AppendText(path, text) Append to the end