Was this helpful?
Derived Fields and Columns
A derived field or column derives its value from a formula. The formula uses the value from another field called the source field. When the value in the source field changes, due to user data entry or application action, the value in the derived field or column is recalculated. Neither the user nor the application can directly place values into a derived field or column.
For a value to appear in a derived field, all of its source fields must be valid. Derived fields do not have validations. You can arrange validations for the source fields to indirectly validate the derived field. Values in derived fields are valid only when their source fields are valid, except for aggregates of table-field columns. 4GL always calculates the value in a derived field, even if the result is based only on the default values in the source fields; for example, when you first display a frame.
You can pass values from a derived field or column as from any field or column. However, because a derived field or column can obtain its value only from an expression, you cannot assign values to it. For example, you can pass the value in a derived field in frame A to frame B in a callframe statement, but you cannot use callframe or any other statement to pass the value back to the derived field in frame A.
The way derived fields operate depends on the mode in which the form is displayed. Derived fields are active when a form is displayed in Fill, Update, and Read modes. If the form is displayed in or changed to Query mode, the value of any derived fields is considered unknown. A table field in Query mode is considered to have an empty data set with respect to aggregate calculations.
You cannot directly clear a derived field with the clear statement. However, clearing one of its source fields has the effect of clearing the derived field.
You cannot use the NextField operation (usually mapped to the Tab key) or resume to place the cursor in a derived field.
There are several basic rules to remember when referencing derived fields and columns:
A derived field or column cannot reference itself (either directly or indirectly).
A simple derived field cannot reference a table field or column directly.
A derived column cannot reference a simple field or aggregate value directly.
A derived field or column cannot reference a local or global variable or a global application constant.
A simple derived field depends on the aggregate of table-field columns, but not on a particular column in a table field.
For more information on using derived fields, see your query language reference guides. See the Character-based Querying and Reporting Tools User Guide for directions for creating derived fields.
Last modified date: 01/30/2023