You are viewing the documentation for Blueriq 13. Documentation for other versions is available in our documentation directory.

What is it for?

Reusable expressions are used to avoid duplicate work, when particular expressions occur (or are expected to occur) multiple times within an application


For the design guide on how to model logic see Decision Management guide.

For more information on what you can use in an Expression, please refer to the Reference Guide for Expression function reference.

What is it?

A reusable expression is a piece of logic that is reused throughout your application. We speak of a reusable expression to indicate that the purpose of it is to be reused, in Blueriq Studio this is shortened to expression.

What does it do?

With reusable expressions you can substitute parts of your logic with that reusable expression, which shortens your logic and makes it more understandable as well as maintainable.

How to – create a reusable expression

There are two ways to create a reusable expression:

  1. Via the Home tab → Logic group → click the Expression button
  2. By selecting (part of) an existing expression in the expression editor and clicking Create Expression

Create a reusable expression via the Expression button

  1. Select the Home tab
  2. From the Logic group select the Expression icon
  3. Fill in the required fields
  4. Click Save or Save & close


Properties

PropertyDescription
ClusterOptionally select the name of the cluster from the drop down list.
NameIt identifies the object. Maximum 100 characters (only letters, numbers and underscores (_)) are allowed.
Functional nameOptional, can be used in documentation
DescriptionOptional
ExpressionThe actual expression is filled in here

Create a reusable expression from the expression editor

  1. Open a logic element, for instance a business rule
  2. Select (part of) an expression used in the logic element
  3. With the right mouse click, a menu appears, select Create reusable expression from it
  4. Fill in the fields of the reusable expression (the expression itself is already filled in)
  5. The original expression that you created a reusable expression from, is now substituted by the reusable expression (named reusable). The reusable expression is denoted by curly braces ({ and }).

Using a reusable expression

Once you have created reusable expressions, you can use them in any logic element. There are two ways to insert a reusable expression in a logic element:

  1. When you are in an expression editor, you can select Inject Expression from the Expressions ribbon. This will insert the selected reusable expression at your cursor position.
  2. If you know the name of the reusable expression, you can also type it in the expression editor, bracketed by curly braces.
The reusable expression has to be a valid expression by itself. It is evaluated before the main expression, and the result is used by the main expression. It is not a form of string-replacing.

For performance reasons we advise to limit the use of reusable expressions to a minimum.



  • No labels