Update (update record subject to referential constraints)

Top  Previous  Next

 

Update( fromform ), VIRTUAL

Update

Updates this object's primary file (see Me) subject to the specified referential integrity constraints.

fromform

A numeric constant, variable, EQUATE, or expression that indicates whether this method was called from a (form) procedure with field history (restore) capability. A value of zero (0) indicates no restore capability; a value of one (1) indicates restore capability. This allows the method to issue an appropriate message when the update fails.

The Update method updates the current record in the primary file (see Me) applying any specified referential integrity constraints, then returns a value indicating its success or failure.

Implementation:

Update constraints are specified by the AddRelation method and they apply to the values in the linking fields. If the constraint is RI:Restrict, the method does not update the current record if the change would result in orphaned child records. If the constraint is RI:Cascade, the method updates the primary file record as well as the linking field values in any related child records. If the constraint is RI:None, the method unconditionally updates only the primary file record. If the constraint is RI:Clear, the method unconditionally updates the primary file record, and clears the linking field values in any related child records.

When a parent file has cascade set to true for its child files, a call to Update will not do the cascade unless the Save method is called prior to changing the value of the linking fields.

 

Return Data Type:     BYTE

Example:

ChangeOrder ROUTINE

IF Relate:Orders.Update(0)        !update subject to constraints

 MESSAGE('Update Failed')         ! if fails, acknowledge

ELSE                              ! otherwise

 POST(Event:CloseWindow)          ! shut down

END

See Also:     AddRelation ,Save