21. 4GL Statement Glossary : Assignment
 
Share this page                  
Assignment
Assigns values to simple and complex form fields.
Syntax
For direct assignments:
simpleobjectname  := | = expression
For query assignments:
complexobjectname  := | = querystatement [submenu]
The following are the parameters for the assignment statement. None of these are 4GL names.
simpleobjectname
Specifies the name of a simple field, a local or global simple variable, a table-field cell, or a simple record attribute. The data types of the expression and the object must be compatible. Cannot be the name of a derived field.
Write table-field cells as: tablefieldname.columnname (which refers to the row under which the cursor is positioned)
or: tablefieldname[integerexpression].columnname
Write record attributes as: recordname.attributename
or: arrayname[integerexpression].attributename
expression
Specifies the value the statement is assigning to simpleobjectname. Any legal 4GL expression. The data types of the expression and the objectname must be compatible. Expression can be a constant or the contents of a field, expression, table field, entire form, global or local record type, array or variable.
complexobjectname
Specifies the name of a form, table field, a table-field row, a record, or an array. Where the table field name and the form name are identical, write the table field as formname.tablename. Cannot be the name of a derived field.
querystatement
Specifies any legal select statement. See Select to a Complex Object.
submenu
Specifies a menu displayed for the duration of a select offering you options relating to each row of values
Description
The assignment statement takes a value produced by an expression and assigns it to a form, a table field in a form, a row or cell in a table field, a simple variable, a record, a record attribute, or an array. (You cannot assign values to a derived field or column.) The assignment statement has two variants, according to the type of field to which a value is assigned:
In direct assignments, you can assign values to fields or simple variables one at a time. See Direct Assignments.
In query assignments, you can assign values to an entire form, table field, table field row, record, or array at once. See Query Assignments.
":=" or "=" are the two forms of the assignment operator. You can use either one. This operator assigns the value of the expression on the right of the statement to the object named on the left. The two must be of compatible data types.
A semicolon (;) statement separator is necessary if the statement is part of a sequence of statements.
For query statements, the optional submenu can be included in assignments to forms, table fields, records, and arrays. For more information about queries, see Select.