Database Functions

Database functions are used to retrieve or write data from the database via script/expression in the inSCADA platform.

Write Data To The Log

ins.writeLog(String type, String source, String activity, String msg)

Used to write information or warning messages to the database log table.

String type: The type of message to write. (info, warning, error ..)

String source: The source of the message to be written. The message can be a description of an object or a module. (Device 01, Communication Channel 1, Pump 1 ..)

String activity: The description of the activity to which the message is to be written. (Read Data From PLC ..)

Return Value: Does not return any value.

Syntax

var ins.writeLog("info","UNIT 01","Starting Sequence","Water Cooling System is Ready");

Fetching Data From The Log

ins.getLoggedVariableValueStats(String[] variableNames, Date startDate, Date endDate)

Returns the min, max, first, last, avg, counter, total, integral values in the requested time range from the table in which the variable values in the database are saved.

String [] variableNames: String array where variable names are stored.

startDate: The start time of the data to be fetched from the database.

endDate: The end time of the data to be fetched from the database.

Return Value: Returns a JSON object that contains the variable and its values.

Syntax

var aaaa

Fetching Daily Data From The Log

ins.getLoggedDailyVariableValueStats(String[] variableNames, Date startDate, Date endDate)

Returns min, max, first, last, avg, counter, total, integral values in the requested daily time interval from the table where the variable values in the database are saved.

String [] variableNames: String array where variable names are stored.

startDate: The start time of the data to be fetched from the database.

endDate: The end time of the data to be fetched from the database.

Return Value: Returns a JSON object that contains the variable and its values.

Syntax

var aaaa

Last updated