Skip to main content

Python

Python scripting

The system supports the execution of python scripts to further process data or change it.

Input

Available variables can be accessed like in the example code below:

s = variable.get('email.sender')
if s is None:
s = 'not set'

If the variable is not set, the dict does not contain it. It's therefore recommended to use the .get() notation shown above instead of the square brackets. For variables that are always defined s = variable['email.sender'] can also be used.

Output

Simply set output in the variable result, it is available in the workflows via ${script_result}

set result to use it in ${script_result}
result = 'this is a single result'  
if result > 10:
action = 'exit'

Multiple output variables are also possible, simply return a dict:

return multiple results and set the desired name
result = dict()
result['var1'] = variable['v1']
result['number'] = 123

The entries will be available via ${var1} and ${number} without the prefix. They are not selectable in the drop-down menus of downstream activities.

All data is stored as text in a string.

Action

When the script finished executing the next action is taken unless it is set in the script. Below exit is taken in case a loop variable exceeds 10.

s = variable.get('script_result')
if s is None:
s = 0

result = int(s)+1
if result > 10:
action = 'exit'

Additional Python packages

The system only support the standard packages. Please get in contact if you need custom setup containing e.g. numpy, pandas and we will definitely work something out.