Monokot Server 1.x
  • What is Monokot Server?
  • Quickstart
  • 🐸Basics
    • Supported OS and Hardware
    • Installation
    • Licensing
    • OPC UA
      • UA TCP Endpoint
      • UA Settings
      • Client Certificates
      • Aliases
      • Access to Object Settings
      • Troubleshooting
    • Security Certififcate
    • Users & Roles
    • Administrator GUI
      • Event Log
      • Users in Monokot Server Administrator
      • Roles in Monokot Server Administrator
    • Startup Parameters
  • 🦊Tags & Devices
    • Devices
      • Diagnostics
      • Devices in the Monokot Server Administrator
    • Tags
      • Parameters
      • Change Trigger
      • Tags in Monokot Server Administrator
        • Go Online
        • Group Action
        • Import & Export
    • Modbus Connectivity
      • Parameters
      • Addressing
      • Diagnostics
    • Siemens Connectivity
      • Parameters
      • Addressing
      • Access to DBs area in S7-1200/S7-1500
    • IEC 60870-5-104 Connectivity
      • Parameters
      • Addressing
      • Time Conversion
      • Diagnostics and Commands
    • OPC UA Connectivity
      • Parameters
      • Addressing
      • Diagnostics
      • How to: Importing OPC UA items
      • How to: Pulling Security Certificate
    • InfluxDB Connectivity (Connector)
      • Parameters
      • Addressing
      • Query Result and Data Mapping
      • Diagnostics
      • How to: Configure for InfluxDB 2.x
    • SNMP Connectivity
      • Parameters
      • Addressing
      • UDP Considerations
  • 🐺Time Series & Stores
    • Stores
      • Backlog
      • Diagnostics
      • Stores in Monokot Server Administrator
    • Time Series
      • Parameters
      • Deadband
      • Sampling
      • Last Sample Repeat
      • Time Series in Monokot Server Administrator
        • Group Action
        • Import & Export
    • InfluxDB Connectivity (Store)
      • Parameters
      • Addressing
      • Data Structure
      • About Metadata
      • Diagnostics
      • How to: Configure for InfluxDB 2.x
    • PostgreSQL Connectivity
      • Parameters
      • Addressing
      • Database Design
      • Data Compression
    • REST Connectivity
      • Parameters
      • Addressing
      • Message Script
      • RestRequestMessage
      • DataContext
      • TimeSeries
  • 🐻Scripts
    • Overview
    • Expression
      • Parameters
      • Import & Export
      • Go Online
    • Programming Examples
      • How to: Calculate Arithmetic Mean
      • How to: DoNothing
      • How to: Writing to Tag
      • How to: Inverting Bits
      • How to: Execute SQL
      • How to: Run Ping
      • How to: Do Simulation
      • How to: String Formatting
      • How to: OPC UA Method
      • How to: Initialize Device Settings from File
    • API
      • Bundle
      • BundlePair
      • Context
      • DataMap
      • DataMapPair
      • DataTriggerInfo
      • Expression
      • MosCrypto
      • MosDirectories
      • MosFiles
      • MosOdbc
      • MosOdbcReader
      • MosProcess
      • MosProcessExecuteResult
      • MosText
      • MosUtils
      • ValueState
Powered by GitBook
On this page
  • Fields
  • Examples
  1. Scripts
  2. API

DataTriggerInfo

The DataTriggerInfo object is intended for obtaining the state of the data trigger (its data source).

Fields

Name

Description

state

states

Examples

The following example demonstrates access to data triggers. In this example, the expression has two data triggers with the names hypotenuse and cathetus and the corresponding data sources. Changing any of these triggers initiates the execution of the expression's code and updates its value.

// For brevity, we will save the length of the cathetus in an intermediate variable
var b = context.data['cathetus'].state.value;

// For brevity, we will save the length of the hypotenuse in an intermediate variable
var c = context.data['hypotenuse'].state.value;

return Math.sqrt(c*c - b*b);

The example below shows an expression that returns True if the data trigger value has not changed within 5 minutes, otherwise it returns False. In this example, the expression has a data trigger named slow and a periodic trigger (with the period of 1000 ms) that initiates the code execution.

// Interval
const INTERVAL = 5 * 60 * 1000;

var now = Date.now();
j
// Saving the time of the last update
var last = context.data['slow'].state.time;
 
// Difference in milliseconds
var millis = now - last;

if (millis > INTERVAL)
  return true;
else return false;
PreviousDataMapPairNextExpression

Last updated 2 years ago

Contains an object of type and represents the last obtained value from the data source (tag).

Contains an array of objects of type and represents the sequence of values obtained from the data source (tag). This property is relevant only if the tag returns a sequence of values, for example, in the case of the IEC 60870-5-104 driver, where ASDU may contain buffered values for the same IOA.

🐻
ValueState
ValueState