Add multiple records using a literal value

Applies to User Roles:

System Administrator

Example:  Duplicate all contact records for advantage. Retain the same information in each record, with the exception of changing the Location to North America. Since Contact Name (contact.name) is a Unique key and Employee ID (user.id) is a No Duplicates key in the contacts file, you must assign unique contact.name and user.id values to the new records. For additional information about key type definitions, see the related topics. In this example, append the value -NA to the contact.name and user.id values to maintain uniqueness.

To mass add records using a literal value:

  1. Open the form in Database Manager. Ensure that you select the Administration Mode check box. In this example, open the following form: contacts. A blank contacts form opens.
  2. Enter the desired value in the Company input field. For this example, select advantage from the Company list.

    Click Fill. to open the list.

  3. Click Search.

    Database Manager performs the equal to search and displays the matching records, if any.

    If the query produces no matching records, Service Manager displays a message.

  4. To display the Mass function buttons, use a query that returns more than one record.

    Select one of the listed records, and then select Mass Add. from the tool bar to start the process of duplicating the records shown in the list.

    Database Manager displays the Mass Add/Update Instruction screen.

  5. Type the applicable statements in the input fields.

    • Statements in the first input field ( Instructions to be executed ONCE at the beginning of Mass Add/Update ) are executed once at the beginning of the add.
    • Statements in the subsequent input fields ( Instructions for action on EACH RECORD ) are executed against every record as it is added.

    For this example, leave the first input field blank and enter the following assignment statements in the Instructions for action on EACH RECORD input fields.

    Statement Purpose
    contact.name in $file=contact.name in $file +“-NA” Appends -NA to the end of all contact.name values.
    location in $file=“North America” Changes the location value to North America.
    user.id in $file=user.id in $file +“-NA” Appends -NA to the end of all user.id values.

  6. Click Execute,

    Database Manager performs the Mass Add in the foreground. Your session is devoted to the add task until it is completed. If you are updating a large number of records, this can take a while.

    Upon completion, Service Manager returns terminal control to you and displays the following message:<nnn>records added to the contacts file where nnn is the number of records added.

  7. Click View Messages to check the messages for errors.

    • A blue icon indicates a required action.
    • A yellow icon indicates an informational or warning message.
    • A red icon indicates an error message.

Close the Messages window to return to the contacts form.

  • Click the More Actions icon and choose Refresh.

    In the new records, the Contact Name (contact.name) and Employee ID (user.id) values are the same as the original records with -NA appended. The Location (location) values are now North America.

    The original records listed before the Mass Add remain in the contacts file with no changes to the original data.

  • Click OK. to return to the contacts form.
  • In the contacts form, do the following:
    • Type North America in the Location field.
    • Click advantage in the Company field.
    • Type Search.

    Database Manager performs the equal to search and displays the matching record(s), if any, in the contacts.qbe form.

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
Adding multiple records

Open a record using Database Manager
Add multiple records using a variable value
Determine the number of records in a record list

Key type definitions