Nodes / Functions
Functions are the key building blocks for any kind of application logic within Heisenware. They can perform a wide range of actions, including:
Fetching and sending data
Processing and manipulating data
Creating objects
Creating and managing database tables
Types
There are different types of functions with different properties and origins.
Static functions
Static functions belong to a class but don't have any context or state, meaning that each of these functions is independent and does not rely on any previous information.
Object functions
Object functions, also referred to as object functions, are the actions an object is able to perform. As they always belong to a specific object, they have context and can include previous information. In order to use an object function, you need to create an object using a create
function first.
Basic structure
Typically, a function consists of one or more input arguments (in programming so called "positional arguments"), a trigger, and an output. In some cases, for example when using a read function to fetch sensor data, the function does not need an input argument to work properly.

Status
Each function has a status indicator showing its condition. The status indicator, a colored circle, can be found right next to the function handler. The status can be:
Green: everything okay
Red: an exception or error has occurred
Gray: function not available or offline
Blue: function execution takes very long to finish (> 2 seconds)
Yellow: the underlying object of this function does not exist (yet)
Hover above the indicator to get details about the function's condition.
Documentation
Built-in functions provide documentation. Click the function name to read it.

Functions only provide documentation if the original code has been documented properly.
Extensions
Extensions allow on-the-fly data processing for function output. There are four extensions:
Modifier: Allows modifying data with JavaScript and JSONata.
Filter: Enables condition-based interruption or continuation of flows using JavaScript.
Recorder: Records data in InfluxDB.
Error Handler: Enables processing of exceptions thrown by a function.
Working with functions
Adding functions
To add a function to an app:
Search the function in the functions panel.
Drag and drop it to the desired section within the logic board.
That's it. You can now start to configure and link the function.
Linking functions
Each part of a function, including extensions, can be configured and linked separately, allowing for maximum flexibility and almost limitless data processing options. Linking possibilities include:
Application logic to user interface
Function to widget and vice versa
Function to page or subpage
Application logic to application logic
Function to function
Function with same function
Function to file
To create a link, drag and drop the part of a function onto the item you want to link it to. When linking to the user interface, you first select the widget and then drag and drop the relevant part of the function onto it.
To see existing links, hover above one part of a function. Any existing link to and from this part is indicated by a light shadow within another function. Links to widgets are indicated by a border around the widget. Additionally, the status lamp of the linked function will glow yellow and next to the each section, the number of linked functions in the respective section is indicated.

Flows
Flows consist of chained functions where output data or modified data serves as an input argument for subsequent functions. The creation of flows involves linking functions together. Flows are typically triggered by the update or change of output data, automatically initiating a sequence of connected functions. Filters within flows act as switches, altering the flow's direction based on the output data. They can interrupt or continue flows in a specific direction depending on the specified conditions.
Commenting functions
When creating apps with many functions, it is always helpful to comment functions so that it is easier to understand what action a particular function performs. To comment a function:
Right-click on the function name.
Click
Comment
in the context menu.Add a comment.
To change a comment, click on the comment and start typing.
Deleting functions
To delete a function:
Right-click on the function name.
Click
Delete
in the context menu.
Or simply select it and click the trash can icon (works for multiple selections as well).
When deleting a function, its links and configuration will be deleted with it. This action can't be undone.
Connect a function with the UI
Application logic and user interface communicate by connecting function input, trigger or output with UI elements. Through this connection, functions can both set and receive widget properties. The link between a widget and the part of the function determines the direction of data exchange, specifying which data or events are transferred.
Last updated