7 19 1 DEF_COND Parameters

LANSA Technical

7.19.1 DEF_COND Parameters

NAME

COND

COLHDG

NAME

Specifies the name of the condition.

Every condition must have a name and it must start with an "*" (asterisk). The second character must be a letter of the alphabet. Any subsequent characters must be in the range A -> Z or 0 -> 9. This rule therefore prohibits the use of condition names that contain imbedded blanks.

Condition names starting with *R, *P, *L or *C followed by 1, 2 or 3 digits must not be used on fields to be displayed on screen panels or used in reports. This will cause a conflict with the field positioning attributes, for example, *R12, *L123, *C01 etc.

These condition names should also not be used: *COLUMN, *COL, *COLHEAD, *COLHDG, *LAB, *LABEL, *NOID, *NOIDENT, *NEWPAGE, *NEWFORMAT, *DESC, *DES.

Also these names are reserved and should not be used: *EQ, *NE, *LT, *LE, *GT, *GE, *AND, *OR, *LIKE, *EQU, *NEU, *LTU, *LEU, *GTU, *GEU and *LIKEU.

Names that conflict with system or multilingual variable names should also be avoided.

The maximum length allowed for a condition name (including the "*") is 10 characters.

Up to 99 conditions can be defined within a program. Every one must have a unique name.

Conditions should be defined before any of the other commands that reference them.

Since the DEF_COND command "defines" something, and is thus strictly non-executable, it is customary for it to be placed at the beginning of the program along with all other definition style commands (eg: DEFINE, DEF_LIST, GROUP_BY, etc).

COND

Specifies the condition that is to be evaluated to test the "truth" of the condition. For more details, refer to Specifying Conditions and Expressions.

COLHDG

Specifies whether or not field column headings associated with a field controlled by this condition are to also be conditioned.

When a field in a print line is printed or a field in a browse list is displayed, you can control whether or not its associated column headings appear by using this parameter.

*YES, which is the default value, indicates that any associated column headings are subject to the condition just like the associated field.

*NO, if used, specifies that no condition controls any associated column headings. The column headings will be printed or displayed according to the normal rules.

For example, making a whole column disappear:

DEF_COND NAME(*AUTSAL) COND('#GROUP = HO') COLHDG(*YES)
 
DEF_LINE NAME(#DETAIL) FIELDS(#A #B #C (#SALARY *AUTSAL))
 

specifies that field #SALARY and its column headings are only to appear on the report if the #GROUP = HO. This means that if the group is not HO, the salary column effectively disappears from the report.

However, making a field selectively disappear:

DEF_COND NAME(*PRTAMT) COND('(#CREDLMT *EQ 0) *OR (#OVERDUE *GT 30)') COLHDG(*NO)
 
DEF_LINE NAME(#DETAIL) FIELDS(#A #B #C (#AMTDUE *PRTAMT) #D #E #F)
 

specifies that field #AMTDUE is only to be printed if the credit limit is zero or the amount has been outstanding more than 30 days. However, the associated column headings always appear on the report.

Please note: A condition controlling a column heading is tested at the time the column heading is printed or displayed. In the case of a report this is at the time the first line on the report page is printed. In the case of a display, this is the time at which the DISPLAY, REQUEST or POP_UP command is executed.

Also: A condition controlling a field in a browse list is only tested at the time the browse list entry is added or updated.

Additionally: Attempting to condition field(s) in a DEF_BREAK (define break) line of type *TRAILING may produce confusing or misleading results because the line is implicitly "trailing" behind the program in terms of the data it is processing.

Finally: Even if all fields on a print line or in a browse list entry have been conditioned not to appear, they will still cause a "blank" line to appear on the report or display panel.