Script

With this node you can run a JavaScript.

It has the following configuration options:

  • Input Files: here you can specify the file that will be presented to the script for processing.
    Note: By default, the Input files parameter is set to files from previous node. In general this is OK, but it can lead to unexpected problems when you use a Script node immediately after a Start From KIOSK node that does not expect any input files. In that case, there are no previous files and the Script node will fail. The solution is to clear the Input Files parameter.
    Select the pencil to open Expression Builder.
  • Variables For Script: here you can define the variables for the script. Options:
    • All Variables from Workable: if you select this option, the variables from the workable will be used.
    • Define Variables: if you select this option, you can specify some additional parameters that will be presented to the script. Select + to add a variable and define a Name and a Value for the variable.
  • Output connectors: here you can specify additional output connectors. From the script you can select any output you want/need, including these additional outputs.
  • Log function feedback: with this checkbox you can specify if the feedback from called API functions will be added to the workable Log. If you check this checkbox, all messages logged by API functions will be returned as a result from the calls, and they will be added to the log of the workable. If you leave this checkbox unselected, any message logged by API functions will only be returned as a result from the calls.
  • Fail on function errors: with this checkbox you can specify if the script node will error in case one of the called functions reports an error. When you select this checkbox, the script will fail immediately when a function returns an error, and the workable will be sent to the failure output. This way you can start without error handling in your script, and still do the right thing when a function fails. When you leave this checkbox unselected, it is the script's responsibility to react correctly when a function returns an error.
    Note: Log Function Feedback and Fail On Function Errors are enabled by default, because it helps during initial Script setup. Initially you probably do not add error handling, and you want to see all possible feedback to find out where you made mistakes in your script. Later, when your script evolves, you might decide to disable one or both options, depending on the functionality and/or error handling you add to the script.
  • Max Concurrent Workers: here you can specify how many concurrent calls to the script can be executed. The script itself normally has no limits, but you might want to limit the maximum concurrency to not completely lock your system on this node if you perform slow calls or long running calls to other components from your script.

    If you set it to 0, the concurrency is not limited. If you set it to 1, this node will only be executed once at the same time. If you set it to 2,  this node might be executed at most 2 times at the same time, etc.

  • Script File: here you can run a script from a file. The script specified in the field below will be ignored when this parameter is specified. Select to expand the script editor to the full dialog.

See Functions in the Script node for more information on which functions you can use in the Script node.