Conditional Fields and Field Calculations
Automatic calculations can be performed using Integer and Decimal fields in a category. By defining a mathematical formula in an index field, it’s possible to use numerical values from other fields to calculate a new value. Exact details on the supported operators and functions of this feature can be found in the section below:
Creating a calculated field
-
Create fields for containing numerical data when designing a category in the Therefore™ Solution Designer. In this example, the 'Invoice Amount (net)' is a Decimal field that should be filled in by the user.
-
Create new numerical fields that will contain the calculated values of the previously created numerical fields. In this example, the field 'Invoice Amount (net)' will be used as the base for the calculation in the 'Tax' field. These two fields together will then be used to calculate the value of the 'Invoice Amount (incl. Tax)' field.
-
For the fields that should be automatically calculated, right-click on the field, select 'Properties', then switch to the 'Formulas' tab. Enter the 'Formula for calculating the field value' that you want to use. Expand the box by clicking the arrow to view available category fields and functions.
Enter any standard arithmetic operators manually: add (+), subtract (-), multiply (*), divide (/), exponential (^). The automatic follows the standard mathematical order of operations.
In this example, the formula to calculate a 20% tax is 'Invoice_Amount_net * 0.2', while the formula for calculating the total invoice amount including tax is 'Invoice_Amount_net + Tax'. -
In an end user application, save a new document into the category.
-
Enter the numerical data in the required fields (e.g., 'Invoice Amount net') so the configured calculations can be performed on the related fields. The calculation is performed instantly. Fields that with a configured automatic calculation are set to read-only, since the user should not be able to make manual changes to them.
Setting conditions for a calculated field
-
In the Field Properties, select the 'Formulas' tab and set the conditions under the 'Conditional Properties' options. Expand the box by clicking the arrow to view available category fields and functions. In this example, when the 'Invoice Amount' is larger than the 'Amount Paid' ('Invoice_Amount > Amount_Paid'), the font color will be displayed in yellow and the background in red.
-
When the conditions are met during data entry, the field for which the conditional formatting was configured will display values based on the set conditions. Should the values not meet the defined conditions, the values will be displayed as normal without applying the conditional formatting.
Creating conditional mandatory fields
-
Start by creating the index data field the condition will rely on, and then the fields where the condition will apply. In this example, the 'E-Mail Address' and 'Phone Number' fields are set to be Mandatory depending on the answer given in 'Preferred Contact Method'.
-
Access the properties of the field the condition should be applied to by right clicking the data field. Navigate to the 'Formulas' tab. Under the section 'Conditional Properties', click the arrow button to open the 'Objects and Functions' window. Here, select the field the condition relies on. In this example, 'Preferred Contact Method'.
-
As 'E-Mail Address' is set to be a mandatory field when the user selects 'E-Mail' as the preferred contact method the condition 'Preferred_Contact_Method = "E-Mail"' is used, and the Mode is set to Mandatory.
-
In case the field is meant to be skipped or ignored in case a condition is met, the 'Mode' is changed to 'Disabled'.
-
When the user adds a document to the category in the Therefore™ Web Client or Therefore™ Navigator they will go through the following experience:
In this case, they set the 'Preferred Contact Method' to E-mail. Doing so, will cause the "E-Mail Address" condition to be met. This turns 'E-Mail Address' into a mandatory field, and disables the 'Phone Number' field.Note: Conditional Mandatory fields is a feature only available for manually added documents. Documents added to a category with this feature through an automated tool will ignore the feature.