/
JavaScript Unit

JavaScript Unit

The JavaScript Unit can be used to write and execute JavaScript. This Unit uses the onCore Code Editor which can be accessed via the Inspector.


Declaring Input and Output Ports

Declare Input Ports with i_MyVar and Output Ports with o_MyVar.

Input and Output Ports Data Types

There are five types of Input/Output ports:

  • String
  • Integer
  • Double
  • Long
  • Boolean

Examples:

  • ib_myBooleanInput would be an Input Port with Boolean data type.
  • os_myStringOutput would be an Output Port with String data type.

Default Functions

By default there are three functions:

  • Startup: is executed once when the JavaScript Unit is triggered after the Project is set into running state.
  • Shutdown: is executed when Workflow stops executing (e.g. when the Project stops).
  • Execute: is executed when the JavaScript Unit is triggered.

Using Project Variables

Project Variables can be used globally in certain Units (JavaScript, Shell Command). To use a Project Variable, enclose the Variable name in '$', for example "$myVariable$".

Related content