Value Ranges
Information
Value ranges are gathered for each data item in the Data Items module.
As a result, you have to do the following for each data item:
define a value range type in the VR type field, that specifies
whether the gathered value range takes effect, and
when the DI is calculated or checked.
define a formula for the value range itself in the Value range field.
Note
Value ranges can be deactivated without the formula being deleted. For this purpose, delete the entry in the VR type field.
Value Range Type
Information
There are three groups of value range types. Via value ranges, data items can be
checked as entry fields upon input ((en) Value Ranges#PL, (en) Value Ranges#PF)
calculated as output fields (CO)
checked, calculated, and changed with Python (PY)
Standard Value Ranges
PL: Check by List
Objective
To check whether the data field input coincides with the defined values
The value range
Details
Numeric data items
List of permitted input values separated by commas.
DI | name | VR type | Value range | Explanation |
|---|---|---|---|---|
000090 | Date deviation Start 1 | PL | 1,2,3,4,5,6,7,8 | Only the values specified can be entered. |
Alphanumeric data items
Specify the list of allowed input values in quotation marks and separated by commas.
DI | name | VR type | Value range | Explanation |
|---|---|---|---|---|
000162 | Class | PL | "A","B","C","D","E","X" | Only the values specified can be entered. |
Notes
When an incorrect input is made,
the "Please check entry" message is displayed and
the incorrect value will not be applied so that the previous value is displayed again.
An entry is correct if it is an element of the value range.
PF: Check Using a Formula
Objective
To check the data field input for values that result from the formulas
The value range
Details
A check formula must return the value 0 or 1, with:
0: FALSE
1: TRUE
Only one formula can be specified for each DI.
One formula may extend over several lines.
Example
DI | name | VR type | Value range | Explanation |
|---|---|---|---|---|
001019 | Requested SD | PF | (DI001019 <= DI001020) || (DI001020 0) | Requested SD must not contain a date which is greater than the date in Requested ED. |
001020 | Requested ED | PF | (DI001019 <= DI001020) || (DI001020 0) | Requested ED must not contain a date which is smaller than the date in Requested SD. |
Notes
When an incorrect input is made,
the "Please check entry" message is displayed and
the incorrect value will not be applied so that the previous value is displayed again.
An entry is correct if the value range formula returns the TRUE value.
CO: Calculations
Objective
To calculate the output value of a field in accordance with the prescribed formula.
The value range
is a calculation formula.
Only one formula can be specified for each DI.
One formula may extend over several lines.
Notes
For incorrectly constructed value ranges, the following error messages appear upon module start:
VR: division by zero
Attempt to divide a number by zero.
VR: result of calculation invalid (storage volume)
Result of the calculation exceeds the defined length of the virtual DI, e.g. when character chains are put together from constants or variables without the use of the TRIM() function.
VR: operants type incompatible
Attempt to execute a calculation between two different data types, e.g. a character string and a number. Convert relevant operants using the corresponding function, e.g. FMT(), ATOI().
VR is invalid: DIxxxxxx
Syntax error in the value range. Also follow-up message on the error messages listed above.
Depending on the specific error, an error message is only displayed once in each session when the value range is opened for the first time. Afterwards , the value range will no longer be executed.
Construction Rule for the CO, PL, PF Value Ranges
Permissible Objects
Operators
arithmetic: +, -, *, /, % (Modulo)
logical:
AND: &&
OR: ||
NOT: !
binary:
AND: &
OR: |
NOT: !
Compare: <, =, >, <=, ==, >=, <>, != (means NOT)
Quotation marks: „"
Parentheses: ( )
Operands
Data items: real, virtual
Variables:
Users: @U
Dynamic: @D
Global: @G
System: @
Program constant
Fixed value: strings, numbers
data type
Integer: 2-byte, 4-byte, mixed
String: arbitrary number of characters (also matchcode*)
Rules
Rules for operators
Arithmetic, logical, binary and comparison operators can be separated by blank spaces between the operants. This has no functional significance, but helps with the readability of a value range.
Quotation marks and parentheses must exactly enclose contents, i.e. blanks may only be included if they have a functional significance.
If the Boolean value of a value range is to be inverted, i.e. FALSE is to be output instead of TRUE, the contents of the value range must appear in parentheses and the expression "!=1” must be appended.
Example
DI | name | VR type | Value range | Explanation |
|---|---|---|---|---|
005297 | KST to be loaded | EXIST(DI005297,808) | EXIST function to check for non-existent records. |
Details
In value ranges, calculations can be performed using "modulo" (operator = %)
Example
DI | name | VR type | Value range | Explanation |
|---|---|---|---|---|
007585 | Time R | CL | HYEXIST3("006428") %86400 | DIxxxxx % DIyyyyyy = remainder of the division (e.g. 9 % 5 = 4) |
Rules for operants
The operand value can be
output directly (e.g. as part of a string) or
simply serve as part of a calculation
Example
DI | name | VR type | Value range | Explanation |
|---|---|---|---|---|
003136 | HB element | CO | TRIM(@G100) + "\" + TRIM(@G106) + "\" + DI001825 + "\" + @191 + "\" + TRIM(@G103) + "\" + "M" + @191 + DI000123 + @G107 | Value is calculated and output |
Rules for input in value areas
Data item: DI<DI ident number>
is always entered with the prefix DI.
Variable: "@ <variable type> <variable number>"
are always specified in quotation marks. The cutting-off of redundant spaces at the end takes place automatically.
Meaning | Variable number |
|---|---|
System variable | @[ID] |
Dynamic Variable | @D[ID] |
Global variable | @G[ID] |
User variable | @U[ID] |
Constant: CONST <"constant ID">
The constant ID is always specified in inverted commas. The cutting-off of redundant spaces takes place automatically.
Fixed value:
Numbers must be specified without quotation marks if they are to be used in calculations. A number enclosed in quotation marks is interpreted as a string.
Strings must be enclosed in quotation marks.
Note
The operants variable and constant must be trimmed in the value range if you do not want the entire data field length to be output as source (for constants, e.g. a length of 70).
Example
The value output is the same as the value input:
Python Value Ranges
PY: Check, Calculation, Change
Information
With Python value range functions, the functions from the Python Api and default Python functions, data items can be checked, calculated and changed.