Administer > Database administration > Data persistence > Record retrieval > Multiple-record functions > Update multiple records using a variable value

Update multiple records using a variable value

Applies to User Roles:

System Administrator

Example: Change the email address for all Advantage contacts records for people located in North America to follow the pattern: firstname.lastname@advantage.com.

To update multiple records with a variable value:

  1. Open the contacts form in Database Manager. Ensure that you select the Administration Mode check box.
  2. Enter the desired value in the Company input field. For this example, select advantage from the Company list.
  3. Enter the desired value in the Location input field. For this example, type North America.
  4. Click Search.
    Database Manager performs the full search and displays the Record List of matching records, if any, in the contacts form.
  5. Select Mass Update from the tool bar to start the process of updating the records listed.
    Database Manager re-displays the initial form with different option buttons.
  6. Do not enter values in any field. Click Complex Update.
    Database Manager displays the Mass Add/Update Instruction screen.
  7. Enter the following assignment statement in the Instructions for action on EACH RECORD input field, as shown:

    StatementPurpose
    email in $file = first.name in $file + “.” + last.name in $file + “@advantage.com”Sets the email address to firstname.lastname@advantage.com.

    The system executes this instruction for each record updated. Then it returns terminal control to you, and displays the message “nnn records updated in the contacts file”, where nnn is the number of records updated.

The topics below comprise an example of how to use multiple-record functions. Follow the steps in this order. If you skip a step, the example will not work.

  1. Add multiple records using a literal value
  2. Add multiple records using a variable value
  3. Update multiple records using a literal value
  4. Update multiple records using a variable value
  5. Avoid invalid duplicate or null key errors
  6. Delete multiple records

Related topics

Multiple-record functions
Updating multiple records
Mass add/update function errors
Options for Mass Update

Update multiple records using a literal value
Determine the number of records in a record list
Open a record using Database Manager