# LogiView

## Calling a Decision Table or Procedure

| The following describes the call process for a decision table. The process also refers to procedure calls.
| It is also possible to link decision tables and procedures by calling a decision table from within a decision table. When the execution of the called decision table is complete, the process control continues the execution the called decision table (sub program technology). If the decision table call is executed as a condition, this is considered to be True if a matching rule is found in the called decision table; otherwise, the condition is False.
| ### Syntax:
| {DT_NAME}() or {DT_NAME}({PAR_LIST})
{DT_NAME} | Name of a decision table/procedure in the format 'DT-Name' or 'Logic Model-Name/ET-Name' when calling a decision table/procedure of another logic model.
{PAR_LIST}
| List with transfer parameters. The type and number of parameters must correspond to the appropriate definition in the "DT-Variables" list of the called decision table/procedure. Date parameters must be entered in database format. A string parameter can be forwarded in single or double quotation marks. In this case the quotation marks are truncated, so only the contents is interpreted as LogiView variable. Therefore, it it also possible to forward values or e.g. a colon as a string parameter.
| No brackets must be used within a string! Logic Model/DT("(1234", 3) is not permitted, an error message is displayed.
| ### Example 1:
| For a decision table the transfer parameters: DT_STR (String) and DT_INT (Integer) are set
Call | Result
Logic Model/DT (Hello, 3) | DT_STR is Hello, DT_INT is 3
Logic Model/DT ('1234', 3) | DT_STR is 1234, DT_INT is 3
Logic Model/DT ("1234", 3) | DT_STR is 1234, DT_INT is 3
Logic Model/DT ("12,34", 3) | DT_STR is 12,34, DT_INT is 3
| ### Example 2:
| In this example the decision table "Fore-bore" is called from within a decision table and the three values "D+7", "ALU" and "D_FORE-BORE" are forwarded. In order to prevent a query the variable "D_FORE-BORE" is pre-assigned the value 0. DT-Variables of the calling decision table:
Name | PN | T | Dim | Pre-assignment | ...
D |  | I | 0 |  |
D_FORE-BORE |  | I | 0 | 0 |
Calling decision table:
T | Li | Cond/Act | R 01 | R 02
B | 10 | Fore-bore (D+7,"ALU", D_FORE-BORE) | yes | :
|  | -------------------------- | ---- | ----
A | 10 | put("Call successful") | yes | no
A | 20 | put("No calculation") | no | yes
DT-Variables of the called decision table "Fore-bore": The allocation of the forwarded values is performed by the value in column Parameter-No. (PN).
Name | PN | T | Dim
DIA | 1 | I | 0
MAT | 2 | S | 0
D_FORE | 3 | I | 0
VALUE |  | F | 0
1.Parameter: | DIA | Variable value 'D' plus 7
2.Parameter: | MAT | "ALU"
3.Parameter: | D_FORE | 0 (Pre-assignment by 'D_FORE-BORE')
| As long as the values of the transfer parameters are not available in the calling decision table/procedure, these values are determined prior to the call (by means of a query if necessary). This is to ensure that the called decision table is always forwarded the values by the parameters list.
| Called decision table "Fore-bore":
T | Li | Cond/Act | R 01 | R 02
B | 10 | DIA | <=20 | <50
B | 20 | MAT == | "ALU" | "ST"
|  | -------------------------- | ---- | ----
A | 10 | D_FORE = DIA*0.5 | yes | yes
A | 20 | VALUE | 1.5 | 2.5
A | 30 | DIA = DIA+VALUE | yes | yes
| Upon successful execution of "Fore-bore", the third parameter of the calling decision table is assigned accordingly:
    D_FORE-BORE  Value of 'DIA' * 0.5
| Although the value of the first parameter has been changed in the called "Fore-bore" decision table, this change is not returned to the calling decision table because this position of the parameters list does not contain a variable but an expression (D+7).