Calculations and decisions

Calculations and Decisions are very similar and as such, they are edited in almost the same way. Both are based on an expression, but with two key differences. Firstly, a Calculation is an expression that can result in any value, but a Decision is an expression that must result in TRUE, or FALSE. Secondly, the result of a Calculation is stored in a Data Item, whereas the result of a Decision is not. It is used only to determine the direction the flow of a process will take.

Expressions can be created in a variety of ways. They can be typed directly into the Expression Editor, or can be built up by dragging and dropping items from either the Function List, or the Data Item List. The Function List shows all the functions available in Blue Prism. When a Function is dragged and dropped into the Expression Editor, the default function text is automatically entered on the screen. Similarly, Data Items can be dragged in from the Data Item List and their names will be automatically entered into the Expression Editor.

Functions can also be composed in the Function Builder area in the centre of the screen. When a Function is selected from the Function List it is displayed in the Function Builder, along with a description of its use and any of its parameters. Parameters can be given values either by typing directly into the fields shown, or by dragging Data Items from the Data Item List. Once the Function has been built, it can be transferred to the Expression Editor using the Paste button.

A Calculation must specify the Data Item into which the evaluated result will be stored. The 'Store Result In' field can be populated by typing in a Data Item name, or by dragging in a Data Item from the list on the right.

When an expression is complete, it should be checked for errors and this can be done by selecting the 'Process Validation' button. Blue Prism will then check the expression and highlight the likely location of the error.

Once checked, an expression can also be evaluated by selecting the Test Expression button. If any Data Items have been used in the expression, a new Expression Test Wizard will appear that enables temporary values to be given to each Data Item, so that a result can be obtained from the expression. If no Data Items have been used in the expression, the evaluated result will be displayed in a pop-up message. Should you wish to only test part of an expression you can select part of an expression by dragging and highlighting with the mouse. When the Expression Test Wizard appears only the selected part of the expression will be used.

Expressions

Expressions are built up from Data Items, Operators, Functions and Constants.

Data items

Data Items are referenced by name and must be enclosed in square brackets, for example [Account Number] .

Operators

Operators are represented by their respective symbol, for example 1 + 2.

Functions

Functions are in the formFunctionName(parameter1,parameter2), for example Mid("Hello", 1, 2).

The syntax for most functions is self-explanatory. Below are details of the more complex functions.

Constants

Text and passwords are represented by enclosing the text in quotes, for example "This is my text".

Numbers are represented by typing the plain number, for example 5 or 1.2

Flags are represented by the words True or False

Dates are represented as a text expression in dd/mm/yyyy format, for example "12/03/2004"

Casting

Casting occurs when an entity of one data type is placed in an expression where another data type was expected.

An example of this may be giving a number to a text function.

Len(100)

The 100 is automatically cast to a "100" text, then the Length function will return "3" since 100 has 3 characters.