Phantom fields

PHANTOM fields define screen-record fields that are not used in the LAYOUT section.

Syntax

PHANTOM { [table.]column
            | FORMONLY.fieldname
        } ;
  1. [table.]column defines the database column to be used to define the field.
  2. FORMONLY.fieldname defines a phantom field not based on a database column.

Usage:

A PHANTOM field defines a form field listed in a screen-record or screen-array, but does not have to be displayed in one of the containers of the LAYOUT section. The phantom fields can be used by dialog instructions of programs but are never displayed in the form.

Phantom fields can be based on database columns defined in a schema file or as FORMONLY field.

Phantom field data is never send to the front-ends. Therefore, you can use a phantom field to store critical data that must not go out of the application server.

For example, if you want to implement a screen-array with all the columns of a database table defined in the database schema file, but you don't want to display all the columns in the TABLE container of the LAYOUT section, you must use PHANTOM fields. With the screen-array matching the database table, you can easily write program code to fetch all columns into an array defined with a LIKE clause.

Form file:

SCHEMA carstore 
LAYOUT( TEXT = "Vehicles" )
  GRID
  {
   <T t1                                  >
    Num      Name            Price 
   [c1      |c2             |c3           ]
   [c1      |c2             |c3           ]
   [c1      |c2             |c3           ]
  }
  END
END
TABLES
  vehicle 
END
ATTRIBUTES
  TABLE t1: table1;
  EDIT c1 = vehicle.num;
  EDIT c2 = vehicle.name;
  EDIT c3 = vehicle.price;
  PHANTOM vehicle.available;  -- not used in layout 
END
INSTRUCTIONS
  SCREEN RECORD sr(vehicle.*);
END

Program code:

SCHEMA carstore
...
DEFINE vl DYNAMIC ARRAY OF RECORD LIKE vehicle.*
...
DISPLAY ARRAY vl TO sr.*
...