Applies to version: 2021.1.x and above; author: Michał Kastelik
Read this article to learn what functions are available when creating your business and form rules and how you can use them. The description includes 15 brand-new functions introduced in WEBCON BPS 2021.
In this example, the new functions will be used in business rules. However, you can use the same functions in your form rules. What is more, some functions can be used only in form rules; they are presented at the end of this article.
In the selected process, to start creating a new business rule, expand the Configuration branch and right-click on the object.
The rule editor window consists of the following elements:
1. Returned value type – allows you to specify what kind of data will be returned as the result of executing the rule:
2. Rule testing section – To test if the rule works, use the following buttons (they are at the bottom of the editor on the left):
3. Dictionary for browsing available elements – on the right side of the editor window, there are tabs for building rules by using the built-in functions and other available options. These are your building blocks that you can drag over into the work area to construct your rule.
As you are building your business rules, you can drag-and-drop the elements from the dictionary to construct the graphical representation of the rule. It will be displayed in the work area, on the left. You can also type directly in the work area, and the editor will suggest elements from the dictionary. You can use the arrow keys and the TAB button to navigate around the work area – essentially allowing you to build rules without using the mouse!
The dictionary is contextual – i.e. in some areas, there will be more available elements than in others. As long as you can see them, you can use all built-in features, functions, values, objects, and parameters to build rules in WEBCON BPS. Now, let us go through each tab to see what you can use for building your rules.
The Operations tab gives you the following elements for building your rules:
1. Arithmetic operations – add (+), subtract (-), multiply (*), divide (/).
2. Logic operations – used to expand function conditions with elements and (AND), or (OR), no (NOT).
3. Comparisons - the following operations are available:
This section contains functions that can be used to create a new business rule. To organize them, functions are grouped by what they do.
Conditional choice This directory contains the IF THEN function to create a logical condition. Additionally, there are elements such as:
Item list (only in WEBCON BPS 2021)
These functions were introduced in the 2021 version. They are available only for business rules created for individual processes.
AI rules
The functions related to the AI analysis mechanism allow the following actions:
Users
Number
ROUND [1.25] [1] -> returns [1.3]
ROUND [1.25] [0] -> returns [1]
ROUND [11.25] [-1] -> returns [10]
Text:
You can use the following functions that operate on text values:
If you want to see how to configure the CONCAT, SPLIT, and INDEX OF text functions, please refer to this article.
Date and time:
Element collections:
Conversions
These are the functions used for changing value type and the display format of a data type field:
Attachments
Attachment functions:
You can also use the following as your rules:
The values tab allows you to use the value stored in a workflow form field as a variable in a business rule. To use it in your rule, find the right form field in the “Values” tab, then drag and drop it to the right place in your function.
The example below shows the SET function definition in which the Start date form field was used as a parameter.
The WEBCON BPS 2021 version introduced 15 new functions available in the business rules editor. The changes are listed in the table below. New functions are marked with green color.
Also, the functions from the following collections have been complemented: Text, element collections, and attachments.
Catalog |
Function |
WEBCON BPS 2020 |
WEBCON BPS 2021 |
Conditional choice |
PATH |
YES |
|
POSITIVE |
YES |
|
|
NEGATIVE |
YES |
|
|
Item list |
ITEM LIST COUNT |
|
YES |
HAS ANY ROWS |
|
YES |
|
SELECT VALUES |
|
YES |
|
AI rules |
AI ANALYSIS RULE COUNT FOR INSTANCE |
YES |
|
AI ANALYSIS BROKEN RULE COUNT FOR INSTANCE |
YES |
|
|
AI ANALYSIS SCORE FOR INSTANCE |
YES |
|
|
Users |
CURRENT USER IS ONE OF |
YES |
|
USER IF ONE OF |
YES |
|
|
USERS |
YES |
|
|
Number |
ROUND |
YES |
|
Text |
TO UPPER |
YES |
|
TO LOWER |
YES |
|
|
TEXT LEN |
YES |
|
|
SUBSTRING |
YES |
|
|
STRING REPLACE |
YES |
|
|
INDEX OF |
|
YES |
|
CONCAT |
|
YES |
|
TRIM |
YES |
|
|
LIKE |
YES |
|
|
CONTAINS |
YES |
|
|
STARTS WITH |
YES |
|
|
SPLIT |
|
YES |
|
Date and time |
NOW |
YES |
|
TODAY |
YES |
|
|
DATE DIFF |
YES |
|
|
ADD DATE |
YES |
|
|
DATE PART |
YES |
|
|
Item Collections: |
GET IDs |
YES |
|
GET NAMEs |
YES |
|
|
IS IN |
YES |
|
|
COLLECTION |
YES |
|
|
GET AT INDEX |
|
YES |
|
SUM |
|
YES |
|
AVG |
|
YES |
|
MAX |
|
YES |
|
MIN |
|
YES |
|
COUNT |
|
YES |
|
DISTINCT |
|
YES |
|
Conversions |
DECIMAL TO TEXT |
YES |
|
TEXT TO DECIMAL |
YES |
|
|
TEXT TO DATE |
YES |
|
|
DATE FORMAT |
YES |
|
|
Attachments |
ATTACHMENTS COUNT |
|
YES |
CONTENT AS BASE64 |
YES |
|
|
CONTENT TYPE |
YES |
|
|
FILE NAME |
YES |
|
|
GET ATTACHMENTS |
|
YES |
Form rules have additional functions related to the behavior of the WEBCON BPS form. As with the business rule functions, they have been divided into groups that make them easier to find.
To create a new form rule, select the "Form rules" node in the Configuration branch, then right-click and select "New rule."
When creating form rules, you can use the same functions as for business rules plus the functions for modifying the form's appearance and behavior.
Behavior
In this directory, you can define the display and hiding options of individual form elements.
The example below sets the Start date form field to TODAY.
Using the SET function, you can also clear the value of a given form field. To do this, assign a value to the selected form field, e.g., EMPTY.
Appearance
This section includes functions that allow you to change the appearance of form elements:
Functions related to the appearance of the form field control (CONTROL):
Identical functions are defined when the appearance of the form field label is changed:
The list of other functions that can be used in form rules is the same as for the business rules:
Attachments
Designers of WEBCON BPS applications have access to numerous built-in functions that allow them to modify the appearance and behavior of document workflows. The list of available functions is expanded continuously, an example of which is WEBCON BPS 2021 that has introduced 15 new functions.
Most of these functions are the same for business rules and form rules. However, there are dedicated functions for form rules that let you modify form’s behavior and appearance.
You can also create custom rules by using the SQL COMMAND function or by creating a Plugin business rule.