LogiView

Integration into DataView applications

The LogiView decision table system can very easily be integrated into other DataView applications. For this purpose decision tables can be called up from every application. The call up takes place analogous to that of a user exit. A difference is made between three types of user exits:

If LogiView is started again as a menu , mask or field user exit during the execution of a decision table this would be a recursive call up of LogiView itself ( and not the call up of a decision table).

This enables the insertion of for example data records into a virtual widget ( with the connected insert instruction ' insert_ent', ' var', ' execute') although another decision table is called up as a pre action user exit of the virtual widget ( and thus starting LogiView again).

This can at the same time lead to a problem:
Assume that you create a decision table as a post-field user exit of the field "Item Destination" and describe the current field within the rule R1 of the decision table with the command ' upd_var' - as for example you want to set the field contents at the same value as the order number:

DT variables:

Name T Dim.
 
Database access
ORDER S 0
 
"ORDER.ORD_NO", actual
DES S 0
 
"ITEM.DESIGNATION",actual

 

T Li Con/Act R 01
 
ELSE
B 10 ORDER != "" yes
 
 
 
 
------------------ -----------------
 
---------------
A 10 DES = ORDER yes
 
 
A 20 upd_var(DES) yes
 
 

As the command' upd_var' calls up the pre- and post- user exit of the described field (provided one exists) the decision table (and therefore LogiView) is called up again. Here you then describe if necessary the current field so that your decision table is called up into which you can describe the current field.

You have now built an endless loop !. But as you not only call up a decision table recursively by restarting LogiView with every recursion the endless loop is recognized and aborted with the message "LogiView has already been started 99 times (recursive) endless loop?".

In order to prevent this you should include a suitable abort criteria into the condition part of the decision table:

Compound variables:

Name T Dia Prealloacation
 
Comment
LOOP L 0 FALSE
 
Indicator for recursion
T Ze Con/Act R 01
 
ELSE
B 5 LOOP no
 
 
B 10 ORDER != " " yes
 
 
 
 
------------------ -----------------
 
---------------
A 5 LOOP = TRUE yes
 
no
A 10 DES = ORDER yes
 
no
A 20 upd_var(DES) yes
 
no
A 30 LOOP= FALSE yes
 
no

The additional compound variable 'Loop' is used as an indicator if the decision tables has been called up already. With the preallocation of this variable with the logic value 'FALSE' the condition B 5 is already met when the decision table is called up for the first time. If the next condition is also met the rule R 1 applies and the corresponding actions are processed.

In the following the variable "loop" is set to the logic value "TRUE" before the command 'upd_var' is called up. If the decision table is then called up as a post- field user exit again when filling in the field the condition 5 is not met this time. The ELSE rule is carried out instead with which no action at all is processed.

The first call up of the decision table is now processed further and hereby the variable "loop" set back to its original value "FALSE".

User exit menu

lgv_sel_run

This user exit can be called up from the select menu (SEL menu) of any widget and starts the execution of a decision table.
The decision table to be executed is specified by the parameter string transferred in the form "compound name/DT name". Instead of compound and decision table name, the number of the decision table can also be transferred (as a string).
If an empty string is transferred as a parameter the user exit 'lgv_sel_run' reads the number of the decision table to be executed from the field "yyy.DTS_REF" of the current mask in so far as this field exists.

With the keyword 'actual' during database access the selected data record can be referenced. ( see description of functions ' sel_value', ' sel_string' or ' sel_logic' of LogiView.)

If several data records where selected before this function was called up, a decision table run is executed for every data record. If an empty string is transferred as a parameter at this point the decision table is executed separately for every data record selected in accordance with the DT number in the field yyy.DTS_REF. Otherwise the same decision table is executed for every data record in accordance with the specification of the parameter string.

lgv_nosel_run

This user exit can be called up from the No-Select menu (NOS menu) of any widget and starts the execution of a decision table.
The decision table to be executed is specified by the parameter string transferred in the form "compound name/DT name". Instead of compound and decision table name the number of the decision table can also be transferred (as a string).
In addition to the user exit 'lgv_nosel_run' it is possible to call up the function lgv_ctr_set_act of the programming interface of LogiView in order to specify the ID number ("C_ID") of the data record which is accessed by LogiView with the key word 'actual':

void lgv_ctr_set_act (l_id)

(As this function has not the 'int' type it has to be defined as "extern void" in the definition part of the C file.) The parameter 'l_id' (of the type long) corresponds to the internal ID number.

In combination with the user exit 'lgv_nosel_run' it is also possible to determine the current data record "from the outside" and to start a decision table for it. A corresponding program part can therefore appear like the following:

#include <stdio.h>
#include <string.h>
extern void lgv_ctr_set_act();
.
.
.
{
int i_row;
char ca_field[81];
long fld;
long l_id;
.
.
mas_rea_fld(fld,i_row,ca_field);
l_id = atol(ca_field);
lgv_ctr_set_act(l_id);
lgv_nosel_run("VB_002/Start");
.
.
}
.

Mask Userexit

lgv_pre_mas "Logic model/DT"

RETURN-CODE:

0 = o.k.

               

1 = Error (the logical value FALSE is returned ior the execution is aborted by the command ' exit()')

This userexit can be called up as a "pre-mask trigger" of any mask and starts a decision table. The name of the DT/procedure to be called up can also be specified with the following name convention:


lgv_post_mas "Logic model/DT"

RETURN-CODE:

0 = o.k.

               

1 = Error (the logical value FALSE is returned ior the execution is aborted by the command ' exit()')

This userexit can be called up as a "post-mask trigger" of any mask and starts a decision table. The name of the DT/procedure to be called up can also be specified with the following name convention:


lgv_pre_act "Verbund/ET"

RETURN-CODE:

0 = o.k.

               

1 = Error (the logical value FALSE is returned ior the execution is aborted by the command ' exit()')

This userexit can be called up as a "pre-action trigger" of any mask and starts a decision table. The name of the DT/procedure to be called up can also be specified with the following name convention:


lgv_edt_act "Verbund/ET"

RETURN-CODE:

0 = o.k.

               

1 = Error (the logical value FALSE is returned ior the execution is aborted by the command ' exit()')

This userexit can be called up as a "edit-action trigger" of any mask and starts a decision table. The name of the DT/procedure to be called up can also be specified with the following name convention:


lgv_post_act "Verbund/ET"

RETURN-CODE:

0 = o.k.

               

1 = Error (the logical value FALSE is returned ior the execution is aborted by the command ' exit()')

This user exit can be called up as "post-action trigger" of any mask and starts the execution of a decision table.
As an alternative it is possible to determine the name of the DT/ procedure called up with the following name convention:

 

Field user exit

lgv_post_fld

RETURN-CODE:

0 = everything O.K.

               

1 = error (execution returns logic value FALSE or execution was aborted by the command exit()'

This user exit can be called up as "post-field trigger" of any mask and starts the execution of a decision table.
As no parameter is transferred to the user exit, the name of the compound and of the execution of a decision table is determined as follows

Example:

Mask descriptor "EDB-ART-SLI"
--> CP name "EDB_ART_SLI"
Field descriptor "T_MASTER_DAT.UNIT"
--> DT name "post_T_MASTER_DAToUNIT"


lgv_pre_fld

RETURN-CODE:

0 = everything O.K.

               

1 = error (execution returns logic value FALSE or execution was aborted by the command exit()'

n n

This user exit can be called up as "pre-field trigger" of any mask and starts the execution of a decision table.
As no parameter is transferred to the user exit, the name of the compound and of the execution of a decision table is determined as follows:

Example:

Mask descriptor "EDB-ART-SLI"
--> CP name "EDB_ART_SLI"
Field descriptor "T_MASTER_DAT.UNIT"
--> DT name "post_T_MASTER_DAToUNIT"Mask/menu procedure LGV parameters