Understanding the advanced statement builder

Parent Previous Next

The Advanced Statement Builder facilitates the construction of logical conditions, defining business rules that are used to control a desired outcome. Any number of discrete statements can be created within the condition workspace and then combined into an overall algorithm using standard Boolean operators: AND / OR. Through the Join Builder function, the preferred operator can be adjusted between adjacent condition statements and also parentheses can be inserted to denote required modifications to the order of these operations - referred to as precedence rules. A statement can comprise any combination of functions - selected from 'Find part of a field', 'Difference between two dates' or 'Add a value to a date' - and field variables, separated by the required operators. For each selected function, the input arguments used to calculate the outputs are closely controlled. Similarly, for each inserted field, the range of validation tags available for selection is filtered, based on the specific entity. Once a function or field has been inserted, system validation rules govern the matching expression operators that can be selected, based on the inherent data type, such as conditional expression operators (= <> < <= > >= IN LIKE) or arithmetic expression operators (+ - * /). A number of actions are available to control the creation and management of statements within the conditions workspace, summarised in the table below.


Action

Description

Add Function

This inserts one of three pre-set formulas into the condition workspace: Find part of a field, Difference between two dates or Add a value to a date. The function name informs the statement builder what calculation to perform, based on the arguments (inputs) specified by the end user.

Add Field

This inserts a validation tag - an entity component - into the condition workspace. The available entities will be governed by the module area from which the advanced statement builder is launched.

Add Operator

This inserts a context-dependent operator symbol immediately after a function or field to control the desired result; these can be a combination of conditional or arithmetic operators to match the expected data type output. This action can only be applied to an unresolved function of field.

Add Value

Enables the matching expression value to be inserted into the condition workspace. This action can only be applied in conjunction with an unresolved operator.

Clear

This action will empty the condition workspace, ready for the construction of a new statement. Where an incomplete statement is displayed, the end user is asked to affirm that the current entry can be deleted.

Add

This will transfer a resolved statement to the Conditions summary table.

Remove

This will remove a resolved statement from the Conditions summary table.

Inserts parentheses to control the order in which individual conditions will be applied. This operates in conjunction with the Join Builder, which is used to adjust the preferred operator between adjacent conditions - AND / OR - and also the relative position of each condition within the overall equation.


The procedure to add a statement function to the condition workspace is as follows:

  1. Click on Add Function. The Function window is displayed.
  2. Using the Function drop-down field, select the desired statement function i.e. Difference between two dates (Datediff), Add value to a date (Dateadd) or Find part of a field (Substring).
  3. For date functions, enter the desired Measure (Days, Hours, Minutes, Months, Weeks, Years) and calculation input values, as appropriate 1.
  4. Alternatively, for a string function, select the desired Field using the drop-down list, enter the Start from character position and finally the Length of the string component. The Up and Down arrows are available to increment or decrement the values, as required.
  5. Click on Confirm. The completed function is displayed in the condition workspace.
  6. Click on Add Operator. The expression drop-down field is inserted into the condition workspace, adjacent to the new function; select an appropriate expression operator for the condition 2.
  7. Enter the matching condition for the function by clicking on one of three options: (a) Add Value - enter the matching text, numeric or date value directly, as governed by the data type 3; (b) Add Function - enables the end user to define a further function as the matching condition; (c) Add Field - choose the desired entity and tag combination using the drop-down fields.
  8. Click on Add. The statement algorithm is displayed in the Conditions summary table 4.
  9. Repeat steps 1 through 8 to add a further function-based condition.
  10. Where multiple conditions have been added to the overall statement, set the required precedence rules using the Join Builder function. This requisite step is covered separately in the topic To set precedence rules for combined statement conditions.
  11. Click on Save 5.


The procedure to add a statement field to the condition workspace is as follows:

  1. Click on Add Field. Using the revealed entity drop-down fields, select the desired entity and tag combination 1.
  2. Click on Add Operator. The expression drop-down field is inserted into the condition workspace, adjacent to the new field; select an appropriate expression operator for the condition 2.
  3. Enter the matching condition for the field by clicking on one of three options: (a) Add Value - enter the matching lookup parameter, text, numeric or date value directly, as governed by the data type 3; (b) Add Function - enables the end user to define a function as the matching condition (described in the 'add a statement function to the condition workspace' procedure above); (c) Add Field - choose the desired entity and tag combination using the drop-down fields.
  4. Click on Add. The statement algorithm is displayed in the Conditions summary table 4.
  5. Repeat steps 1 through 4 to add a further field-based condition.
  6. Where multiple conditions have been added to the overall statement, set the required precedence rules using the Join Builder function. This requisite step is covered separately in the topic To set precedence rules for combined statement conditions.
  7. Click on Save.


Note

1 The input values available for selection - entity fields - will be governed by the module area from which the statement builder is launched.

2 For a date argument the choice of values are typically + - * / = <> < <= > >=; for a string argument the choice of values are typically <> = LIKE; for a lookup argument the choice of values are typically <> = IN.

3 Text and numeric values should be entered without quotation marks; for date entries, use the calendar icon (), or type in the value directly (format DD/MM/YY or DD/MM/YYYY).

4 To remove an existing condition statement, select the corresponding row in the condition summary table and click on Remove.

5 To amend the function constraints, select the corresponding row in the condition summary table and double-click on the function in the condition workspace.


See related topics....

To set precedence rules for combined statement conditions