Link

A Link is a connection between two Graph nodes. The node can be any piece of business logic or an adaptor

The graph is traversed by executing each node in turn and following the relevant link from the current node to the next node based on the return value of the current node. The links are traversed in the following priority order: 

  • Error  - this is the most important condition and will always execute first if the node does not execute correctly 
  • Conditional - any conditional expression that evaluates to True 
  • Goto - if none of the above links are traversed 

By default when a new node is added by dragging out from one node the default Link type is Goto. For the graph to be valid it should only have one Goto Link per node. 

To change the link from a Goto to an Error or a Conditional Link the type of link can be chosen in the Edit Link panel on the right hand side of the window when the link is selected. 

The Edit Link panel allows the link type to be chosen and an optional Description to be added to the link. It is necessary to save the Link after changing the type or changing the description. Any description will be shown on the link instead of the conditional rule.

If the Conditional Link type is chosen then either a Basic or Advanced Conditional Logic test can be chosen.  The first Conditional link that returns True is traversed. The order in which the conditional links are evaluated is not guaranteed (though it is actually the order in which they were created) so it is the graph builders responsibility to ensure that they are mutually exclusive. The Conditional link will use the automatically generated VAL object which is the result of the previous node execution in order to evaluate whether it is True or not. 

The Description field for the link can be used to modify the label shown on the graph. This is useful for cases when you have a long condition that you wish to shorten. The text can include any kind of characters including emojis!

As an example of Conditional Links where it is necessary to have exclusive conditional test consider the following situation where a database READ node is executed and you to determine whether you have received zero, one or more records in response to the query. 

In this situation there are four links: 

  • Error - to ensure that any problems executing the query are handled correctly 
  • More than One Record - the returned object is a JavaScript Array 

    Array.isArray(VAL)
  • No Records - ensure that this is not an array and that the returned object does not have any of its own properties

    !Array.isArray(VAL) && Object.getOwnPropertyNames(VAL).length == 0
  • Goto - used to capture the case when there is exactly one record