CLIPPED

 

CLIPPED operator takes a character operand and returns the same character value, but without any following spaces.

 

Usage

 

Character expressions often have a data length less than their total size. The following DISPLAY statement, for example, would produce output that included 200 trailing blanks if CLIPPED were omitted but displays only 22 characters when CLIPPED is included. The following code sample illustrates the CLIPPED operator:

 

MAIN

  DEFINE my_string CHAR(24)

  LET my_string = "Test string char(24)"

  DISPLAY "QX chars added to the end" at 5,5

  DISPLAY "of unclipped string:" at 6,5

  DISPLAY my_string, 'QX' at 8,5

  DISPLAY "QX chars added to the end" at 10,5

  DISPLAY "of clipped string:" at 11,5

  DISPLAY my_string CLIPPED, 'QX' at 13,5

  CALL fgl_getkey()

END MAIN

 

CLIPPED operator can be useful in the following kinds of situations:

 

CLIPPED operator can affect the value of a character variable within an expression. CLIPPED does not affect the value when it is stored in a variable (unless you are concatenating CLIPPED values together).

 

Relative to other 4GL operators, CLIPPED has a very low precedence.  This can lead to confusion in some contexts, such as specifying compound Boolean conditions. For example, qfgl parses the condition:

 

IF LENGTH(f1) > 0 AND f1 CLIPPED != "first_name" THEN

 

as if it were delimited with parentheses as:

 

IF (((LENGTH(f1) > 0) AND f1) CLIPPED) != "first_name" THEN

 

To achieve the required result, you can write the expression as:

 

IF LENGTH(f1) > 0 AND (f1 CLIPPED) != " first_name " THEN

 

 

References:

USING operator