Progress
Language Reference
= Assignment Operator
Assigns the value of an expression to a database field or variable.
DATA MOVEMENT
![]()
SYNTAX
field
The name of a database field or variable to which you want to assign the value of the expression. If the field is an array, and you do not name a particular element, Progress stores expression in each element of the array. If you name a particular element, Progress stores expression in that element.
The left side of an assignment can also an attribute or one of the following Progress keywords: FRAME-VALUE, SUBSTRING, or OVERLAY. (See the FRAME-VALUE Statement, SUBSTRING Statement, or OVERLAY Statement reference entries for more details.)
expression
An expression with a data type that is consistent with the data type of the field. If field is integer and expression is decimal, then Progress rounds the value of the expression before assigning it. If field is decimal and expression is decimal, then Progress rounds the value of the expression to the number of decimal places defined for the field in the Dictionary or defined or implied for a variable.
NO-ERROR
Specifies that any errors that occur as a result of the assignment are suppressed. After the assignment statement completes, you can check the ERROR-STATUS system handle for information on any errors that might have occurred. In any case, if an error occurs the assignment is canceled and any changes to field values within the assignment are undone. If the assignment occurs within a transaction, any changes to variables, work table fields and temporary tables fields are also undone, unless you define the variable or field with the NO-UNDO option.
EXAMPLEThis procedure resets all the monthly quota values to 0 in all salesrep records. If you want to set values for individual array elements, you can do so by making an explicit assignment using the assignment statement and a specific array reference, such as month-quota[1] or month-quota[i].
NOTES
- If you assign a value to a database field, any ASSIGN trigger associated with that field executes at the end of the assignment statement (after any index changes are made). If the trigger returns ERROR, the assignment fails and the database changes are undone.
- You can embed an assignment in a SET or UPDATE statement.
- For multiple assignments, use the ASSIGN Statement. This is more efficient than multiple assignment statements.
SEE ALSO
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |