Writing a Function

The built-in function allows the user to develop their own function to implement logic that is not present in library functions.

To add a new inline function to the app, go to the app and click the "New Function" button. A new function named "NEW FUNCTION" will appear in the application window.


First, you need to configure Settings.
Here you can enter the function name and description
Here you can delete a function if you no longer need it. Be careful, you can't undo deleting an inline function
Here you can add incoming and outgoing ports. By default, any function already contains an incoming 'in' port and an outgoing 'out' port.
To add a port, give it a name and click Add


Here you need to code the logic of your function. By default, the new function already has a handler function for handling incoming events. It intercepts all events regardless of the port they were sent to.

  • ev - the incoming event. It contains data as a json object
  • ctx - application context. It contains route, shared state and log as described in the Applications and Functions page
    To access a specific output port, pass its name to the route method:
route(ev, 'sum')

Creating a function that will count the multiplication of the count and price columns. To do this, create a second output port named 'res'. In this case, the multiplication counting function will look like:

exports.handler = async(ev, ctx) => {
  const { route, log } = ctx;
  route(ev, 'out');
  const res = ev.price * ev.count
  log.info('Multiplication result is', res)
  route(res, 'res')
  • route(ev, 'out') - will send an event without changing to an output named 'out'
  • route (res, 'res') - will send the calculation result to the output named 'res'
  • log.info - log some information from the Function.

In addition to the handler, a setup event is support as described in the Applications and Functions page.

The full application log is in the Application->Logs tab

What’s Next

Next up is exporting a Function and Creating a Function Schema