Using base fields with the @ option

You cannot place an expression in a DEFINE FRAME statement because no values exist at compile time for ABL to format. Since you often need to put derived data in frames, you need a way to handle expressions. One solution is to create variables to hold the values. Another solution provides more flexibility: create variables with the characteristics of the expression results (data type, formatting, and label) as base fields. You can include the base fields in the frame definition and then replace the base field with any compatible expression result at runtime using the @ option of the DISPLAY statement.

Here is an example:

DEFINE Base1 AS CHARACTER NO-UNDO NO-LABEL.

DEFINE FRAME Frame1
  Name SKIP
  Base1 SKIP
  Phone SKIP
  WITH NO-BOX.
. . .
IF Contact EQ "" THEN
  DISPLAY Name "No Contact" @ Base1 Phone WITH FRAME Frame1.
ELSE
  DISPLAY Name Contact @ Base1 Phone WITH FRAME Frame1.
. . .

The previous example compiles a phone list of customer and contact names. If no contact is on file, "No Contact" appears in the report.