Calculated Fields Workflow Action

In this post, you’ll learn everything about the Workflow Action “Calculated Fields” and how to use it effectively to perform calculations, identify text, and format data.

What are Calculated Fields?

This function is based on a defined set of formulas that allow you to perform complex transformations. It consists of three main components: Parameters, Relation Parameters, and Formulas.

1. Parameters

Parameters are the fields of the workflow module that you can use for your calculations. These parameters are included in formulas using the format `{P0}`. When you add a new parameter, the interface will display which parameter the respective field has. This way, you always have full control over how the data is used in your calculations.

2. Relation Parameters

Relation Parameters give you access to all one-to-many relationships of the module and their fields. These are included in formulas using the format `{R0}`. This allows you to evaluate and consider data from related records. It gives you the ability to perform more complex data analyses and transformations.

3. Formulas

Under Formulas, you define the specific formula that should be applied to a particular field. First, select the corresponding field and then enter the formula in the text line. You can nest multiple formulas within each other or chain them together. To do this, simply add another formula in place of a parameter part in another formula, or append a new formula to your previous one. It’s important to ensure that the notation is correct, as otherwise the evaluation could fail.

Supported Formula Categories

  • Logical Functions: These yield values of 0 or 1 and are ideal for comparisons like “equal” or “greater than or equal to.”
  • Text Functions: Use these to transform text in different forms.
  • Mathematical Functions: Utilize all common mathematical operations to transform numbers.
  • Date Functions: These are useful for transforming date values or setting them based on certain conditions.
  • Control Functions: With the ifThenElse function, you can perform complex queries and conditional checks. Nestings are possible here to consider multiple conditions.
  • Counter Functions: These functions count records within the system and add counters to them.
  • JSON Functions: JSON Arrays can be transformed according to specific rules, and specific values can be extracted.
  • PHP Functions: These functions can be used to transform PHP arrays.

With this overview, you are well-equipped to optimally use Calculated Fields in your workflows.

Logical Functions

Logical functions are returning true or false in the form of 1 and 0 so checkboxes typed fields can be filled with these functions. They can be also used as the logical condition for the ifThenElse function.

Text Functions

Text functions are used to manipulate text in various ways. All the functions listed here are fully supports UTF-8 texts, so special characters should not raise any problems.

Mathematical Functions

Mathematical functions are used to manipulate numbers in various ways. Several mathematical operators are implemented as functions in Calculate Fields.

Date Functions

There are several date functions implemented in Calculate Fields, so the user can manipulate dates in many ways. Most of the functions uses a format parameter, which is used to set the result of the functions formatted as the user wants to. The options for these formats are equivalent with the PHP format parameters:

The following date functions can be used with calculated fields:

Control Functions

There is only one control function implemented in Calculate Fields so far, but this function ensures that the user can write very complex formulas with conditions. Since the functions can be embedded in each other, the user can write junctions with many branches.

Counter Functions

There are several counters implemented in Calculate Fields which can be used in various scenarios.

The counters sorted into two groups:

  • Global counters: Counters which are incremented every time an affected formula is evaluated
  • Daily counters: Counters which resets every day. (Starting from 1)

You will find more details on each counter on this page: Global Counter Manager

In this chapter we assume that the counters current value is 4, so the incremented value will be 5 with the given format.

JSON Functions

With the various JSON functions within the Calculated Fields, you can process JSON arrays and, for example, extract specific values from arrays or combine values into new JSON arrays.

PHP Functions

With the PHP functions, serialized PHP arrays can be transformed.

Marini Systems GmbH | Contact SupportMarini Website | Privacy Statement | Legal