Modify Records

Type

Processing Command

Purpose

The modify records command modifies records in a specified table.

Syntax

modify records [in TABLENAME|RELATIONSHIP] [named "UNIQUE RELATIONSHIP NAME" ]] [with  ( selection criteria) ] FIELDNAME := MODIFIED VALUE ;|.

Usage

The modify records command must specify the field values to be changed in the Target table. The Target table may be the Primary table specified at the start of a for command, or a related table specified within a for loop.

When you modify records in the Primary table, the keyword in is omitted and no punctuation is used after the modify records command (see Example 1). If no selection criteria are specified, all the records in the Primary table are modified.

When you modify records in a table other than the Primary table, the keyword in precedes the table name, and the command ends with the appropriate punctuation mark (a semicolon or a period - see Example 2). If no selection criteria are specified, all the records in the specified table are modified.

Source data used to modify records may come from the Primary table, a Data-entry form, system variable, or calculation. Alternatively, you can use the copy all from command to specify a Source table from which to copy field data.

As data is entered in the Target table, automatic error checking is performed. Errors are logged to an error file.

You cannot list or modify more than 255 fields in a single DQL Procedure.

Example 1

for MEMBERS with ( any RESERVATIONS TOTAL DUE > 3000) ;

modify records

TOTAL DUE := ( TOTAL DUE - data-entry DISCOUNT) .

end

 

This script tells DataEase: (1) Process all the MEMBERS records that have any related RESERVATIONS record with a TOTAL DUE greater than $3000, and (2 ) modify each MEMBERS record by subtracting the DISCOUNT amount entered in the Data-entry form from the value in the TOTAL DUE field in the MEMBERS table.

Example 2

for MEMBERS with STATE = "NY" ;

modify records in RESERVATIONS

TOTAL DUE := TOTAL DUE + NY SALES TAX .

end

 

This script tells DataEase: (1) Process all the MEMBERS records that have NY in the STATE field, and (2) for each MEMBERS record that is processed, find all the related records in the RESERVATIONS table. Modify each related RESERVATIONS record by adding the NY SALES TAX amount to the value in the TOTAL DUE field.