Functions

Functions are the key building blocks for any kind of application logic within Heisenware. They are visual representations of actual code functions that can perform a wide range of actions, including fetching data, processing information, creating objects, and managing database tables.

The Anatomy of a Function

Each function in the Flow Builder is a visual representation designed to mirror the structure of traditional software functions. Typically, a function consists of:

  • Input(s): Where the function receives data (arguments) to work with.

  • Trigger: The signal that tells the function to execute.

  • Output: Where the function provides its result for further processing.

  • Optionally functions can be extended.

A function to merge objects with two inputs, trigger and output

Types of Functions

There are two main types of functions, distinguished by how they handle data and context (state).

Static Functions

Static Functions belong to a Class and operate without any context. Think of them as general utilities that are independent and don't rely on any previously stored information to work.

Member Functions (Methods)

Member Functions, often called methods, belong to a specific Instance of a Class. Because they are tied to an instance, they have context and can use the data stored within that instance.

A Practical Example

To see how these function types work together, let's use the Email Class:

  • A Class is a generic blueprint, like the Email Class.

  • An Instance is a specific, working copy you create from it, like myOffice365Account.

To create your instance, you use the create function, which belongs to the Email Class itself. This is a perfect example of a Static Function, as you use it without needing a pre-existing email configuration.

Once you have your myOffice365Account instance, you can use its send function. The send function is a Member Function because it belongs to and acts on your specific instance, using the unique server settings stored inside it.

Working with Functions

This section covers the practical actions for using functions in the Flow Builder.

Adding Functions

  1. Search for the function in the Functionality Library or the Flow Builders toolbar.

  2. Drag and drop it to the desired section on the Flow Builder canvas.

Linking Functions & Creating Flows

A Flow is a sequence of chained functions where the output of one function serves as the input for the next or just triggers the next function. You create flows by linking functions together.

  • To create a link, drag an output of one function to an input or the trigger of another.

  • To see existing links, hover over an input, trigger, or output. All associated links will be highlighted.

Data Binding (Connecting to the UI)

Functions are designed to communicate directly with the user interface. This bidirectional connection, known as data binding, allows you to hand over data and events between the backend logic and frontend widgets.

From the perspective of a function, there are three types of bindings:

  • Input Binding: A function's input can be linked to a widget property (e.g., the value of a Form). This allows your backend logic to receive and process live data entered by the user.

  • Trigger Binding: A function's trigger can be linked to a widget event (e.g., the onClick event of a Button). This allows user interactions on the frontend to initiate a backend process.

  • Output Binding: A function's output can be linked to a widget property (e.g., the value of a Circular Gauge). This allows your backend logic to send data back to the frontend to drive visualizations and dynamically update the user interface.

Commenting Functions

To make your logic easier to understand, you can add comments:

  1. Right-click on the function's name.

  2. Select Comment from the context menu and add your text.

Deleting Functions

To delete one or more functions:

  • Select the function(s) and click the trash can icon in the toolbar.

  • Or, right-click on a function name and select Delete from the context menu.

Function Properties

Every function on the canvas has features to help you understand its status and purpose.

Status Indicators

Each function has a colored status indicator next to its name. Hover over the indicator for details.

  • 🟢 Green: Everything is okay.

  • 🔴 Red: An exception or error has occurred.

  • ⚪ Gray: The function is not available or offline.

  • 🔵 Blue: Function execution is taking longer than 2 seconds.

  • 🟡 Yellow: The underlying object for this function does not exist (or is not yet created).

In-App Documentation

Many built-in functions provide their own documentation. To read it, simply click on the function's name in the Flow Builder.

Function documentation

Last updated