0% found this document useful (0 votes)
63 views

Expression Writing Guide

Uploaded by

Cristian Cabello
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Expression Writing Guide

Uploaded by

Cristian Cabello
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Expression Writing Guide

This guide provides a basic overview of how to write Expressions within the Stage properties
of a Blue Prism Process or Business Object. You can use it to familiarize yourself with these
skills before you begin the training, or to refer back to as you progress through the training.

Commercial in Confidence
The training materials and other documentation (“Training Materials”) provided by Blue Prism as part of the
training course are Blue Prism’s Intellectual Property and Confidential Information. They are to be used only
in conjunction with the Blue Prism Software which is licensed to your company, and the Training Materials are
subject to the terms of that license. In addition, Blue Prism hereby grants to you a personal, revocable, non-
transferable and non-exclusive license to use the Training Materials in a non-production and non-commercial
capacity solely for the purpose of training. You can modify or adapt the Training Materials for your internal use
to the extent required to comply with your operational methods, provided that you shall (a) ensure that each
copy shall include all copyright and proprietary notices included in the Training Materials; (b) keep a written
record of the location and use of each such copy; and (c) provide a copy of such record to Blue Prism on request
and allow Blue Prism to verify the same from time to time on request.

For the avoidance of doubt, except as permitted by the license or these terms, you cannot (a) copy, translate,
reverse engineer, reverse assemble, modify, adapt, create derivative works of, decompile, merge, separate,
disassemble, determine the source code of or otherwise reduce to binary code or any other human-perceivable
form, the whole or any part of the Training Materials; (b) sublease, lease, assign, sell, sub-license, rent, export,
re-export, encumber, permit concurrent use of or otherwise transfer or grant other rights in the whole or any
part of the Training Materials; or (c) provide or otherwise make available the Training Materials in whole or in
part in any form to any person, without prior written consent from Blue Prism.

© Blue Prism Limited, 2001 - 2019

All trademarks are hereby acknowledged and are used to the benefit of their respective owners.
Blue Prism is not responsible for the content of external websites referenced by this document.

Blue Prism Limited, 2 Cinnamon Park, Birchwood, WA2 0XP, United Kingdom
Registered in England: Reg. No. 4260035. Tel: +44 870 879 3000. Web: www.blueprism.com

Commercial in Confidence Expression Writing 2


Expressions
Expressions are formulas that calculate a value, which can be used within the properties of many of the Stages
within Process Studio and Object Studio. There are various features available which can assist you with the
construction and testing of Expressions.

EXPRESSION CHOOSER WINDOW

The essential components for building an Expression are the Functions list, the Function Detail / Expression
Function Builder area and the list of Data Items available for use within the Process Solution. The Expression
area is where all of these components come together to form an Expression - which can be validated and tested
using the Validate and Evaluate Expressions buttons.

It is possible to enter Expressions using a variety of methods: users can type Expressions directly into the
Expression area, drag-and-drop Functions and Data Items into the Expression area or use the Expression
Function Builder to construct Functions before pasting them into the Expression area.

Commercial in Confidence Expression Writing 3


Functions

Term Definition

Conversion A list of Functions used to convert values from one Data Type to another, e.g.
ToDate(“01/01/2020”) converts a Date stored as Text into a Date Data Item

Data Retrieves the number of Bytes in binary Data, to give an idea of the size of the Data

Date A list of Functions that perform operations that will result in Date, DateTime, Time or TimeSpan
values

Environment A list of Functions that retrieve information from the Blue Prism Environment and from the Local
Environment running that instance of Blue Prism, e.g. retrieving the version number of Blue
Prism, BPVersionMajor() or the Windows Operating System being used, GetOSVersion()

Exceptions A list of Functions that can be used to retrieve information from Exceptions, such as
ExceptionDetail(), ExceptionStage() and ExceptionType(), or a literal Text value of an Exception
Type that can be used to output the Exception Type as text.
* Exception Functions can only be used between Recover and Resume Stages, when a Process or an
Action is in Recovery Mode

File Consists of two Functions, one used to read the contents of a file as binary Data,
LoadBinaryFile(Filename), and one used to read the contents of a text file,
LoadTextFile(Filename)

Logic A list of Functions that use Flag values, either the literal values ‘True’ or ‘False’, or Functions that
check whether a certain Text value is valid as another Data Type, producing a Flag, or Functions
that perform an operation on two values to determine a Flag value, e.g. Greater than (>), Value >
Value, is True; or And (AND), (Value1<Value2) AND (Value3<Value4) is True

Number A list of calculation Functions that can be performed on values, such as Add (+), which simply
adds two values and produces a result 1 + 2 outputs 3, or Sqrt(Number), which results in the square
root value of the Number provided

Text A list of Functions that can be performed on Text values, such as Trim(Text), which trims a single
Text value with any white space down to just the characters, Trim(“ Text ”) results in “Text”,
or Concatenate (&), which joins two Text values together to produce a result, “Expression_” &
“Guide” results in “Expression_Guide”

Commercial in Confidence Expression Writing 4


Constructing Expression Statements
The Function Detail area is where an explanation of the selected Function is displayed, including a list of the
fields that are required by the Function to operate. Users can enter values or drag and drop Data Items or
Functions into the fields and then use the Paste button to add the completed Function into the Expression area.

The Data Items area is where users can select Data Items or Collection Stages for use within an Expression (by
dragging and dropping) or to store the results of an Expression in the Store Result In field. Data Items must be
wrapped in square brackets when referenced within an Expression, e.g. [Data Item]. When a Data Item is used
within an Expression, the value or values that are stored within them will be made available for use by the
selected Functions.

A Data Item used in the Store Result In field can also be used in the main body of the Expression itself.

Commercial in Confidence Expression Writing 5


Collections store multiple values in rows and columns - to include a particular set of values (or a ‘field’) from a
Collection within an Expression, users must reference the Collection field directly.

Collection fields can be used as part of an Expression, for example: a Calculation Stage that is positioned
between the start and end of a Loop, can use the data within the Collection field to perform a calculation. As the
flow passes through the Loop Start Stage, the first row of the Collection is selected and the row field values are
made available for use by the Expression. As the flow passes through the Loop End Stage and loops back to the
Loop Start Stage, the next row in the Collection is selected and row values made available. Once all rows within
the Collection have been selected, the flow will move past the Loop End Stage.

To include a Collection field within an Expression, users must use ‘dot-notation’ - which is where the Collection
name (e.g. My Orders) and the field name (e.g Quantity) are included within the Expression, separated by a full
stop [My Orders.Quantity].

The properties of some types of Stage (e.g. Decision Stages or Calculation Stages) are dedicated to building
Expressions. Whereas the properties of other types of Stage contain only particular Value fields into which
an Expression can be entered. In these cases, a small calculator icon to the right-hand side of the field can be
clicked to launch an Expression Chooser window - any Expression written here, will be entered into the field upon
selecting OK and closing. Alternatively, users can enter an Expression directly into the Value field.

Commercial in Confidence Expression Writing 6


Expression examples explained
Sometimes Expressions can be as simple as a Data Item, [Full Name].
Other times Expressions can be more complex, [Forename]&“ ”&[Middle Name]&“ ”&[Surname].
Both of these Expressions could potentially output an identical result but are formulated differently.

Expressions

[Item ID]<>””

This Expression (used within a Decision Stage in video 9.2) is made up of three parts and is asking:
is there a value in the Item ID Data Item?

[Item ID] <> “”


The first part is a The second part is The third part is an
Data Item containing the Function empty Text value.
a Text value. Not equal (<>).

So the Expression states that the value contained within Item ID is not equal to an empty Text value, while there
is a value in Item ID this would be True, when there is no longer a value in Item ID this would be False.

[Forename]&“ ”&[Surname]

This Expression is made up of five parts and is joining two Text values together with a space in between.

[Forename] [Surname] & “”


The first and fifth parts are The second and fourth parts are The third part is a Text value
Data Items containing Text Concatenate (&), which joins two with a single space between
values e.g. “John” and “Smith”. Text values together. the quotation marks.

So the result would be John Smith.

Commercial in Confidence Expression Writing 7


AddDays(Today(), [Trial Duration])
This Expression is a single Function with two Parameters, Function(Parameter, Parameter).

AddDays() Today() [Trial Duration]


The Function AddDays() that uses The first Parameter is a Date value, The second Parameter is a
a Date and a Number value to in this example the Function Today() Number value, in this example
calculate a future Date. is used to get the current date. obtained from a Data Item.

In this Expression the Function AddDays() is using todays date and adding the number of days that the Trial
Duration lasts for, in video 4.4 the value 30 is used, so the AddDays() Function would calculate a Date value 30
days from today. If the value of Trial Duration was a negative value such as -30, then the AddDays() Function
would calculate a value which was 30 days before Today().

InStr(ExceptionDetail(), “Number of Races is zero”) > 0

This Expression (used within a Decision Stage in video 8.4) is made up of three fundamental parts, that is asking
does a certain Text value contain another Text value.

InStr() ExceptionDetail() “Number of Races is zero”


The first part is the Function InStr() The first Parameter, is used as The second Parameter, is compared
which contains two Text value a reference string of characters to the first Parameter for an
Parameters between its brackets. within a Text value. identical string of characters.

> 0
The second part of the Expression
is the Function Greater than (>) The third part is the Number
which compares the size of the value zero (0).
values either side.

The Expression is asking whether the string of characters that make up the Text value “Number of Races is zero” is
present anywhere in the string of characters that make up the Text value ExceptionDetail().
If the second Parameter is found within the first Parameter, then the InStr() Function will return a number value
which represents the position in the first Parameter where the second Parameter was matched. If this value is
greater than zero, then a True value will be the outcome, otherwise it will be False.

The requirements for a Function to operate correctly can vary. Some Functions are independent and
do not require any Parameters to fulfill their outcome, such as Today(), which simply returns today’s
Date value. Some Functions require one or more Parameters if they are to produce an outcome - in
these cases, it is up to the user to decide which Function is appropriate and to provide the Parameters
needed to produce the desired outcome.

Commercial in Confidence Expression Writing 8


[Staff Data.Full-Time] = True
This Expression is made up of three parts and is asking whether the value in the Full-Time column in the Staff
Data Collection is True.

[Staff Data.Full-Time] = True


The first part is a reference to a The second part is the Function The third part is a
specific column in a Collection, Equal (=) to compare whether the Flag value of True.
dot-notation is used. values on either side are the same.

The Expression determines whether the value contained within the Full-Time column in the Staff Data Collection
is equal to True. If so, a True Flag value will be the outcome, otherwise it will be False.

Commercial in Confidence Expression Writing 9

You might also like