Example 7: Update records

In this example the Import tool is used to update records in EMu. Updating records only requires that a unique field (or combination of unique fields) is used to identify an existing record. Another way of expressing this is that if a unique field (or combination of unique fields) is present in the Import data file and there is a matching record, the matching record will be updated rather than a new record being created.

Uniqueness is determined by a combination of two conditions. Both must be met:

  1. The field must be specified as unique in the back-end.

    Every module has at least one field that is specified as unique in the back-end by default: IRN.

    The Unique attribute can be set using the Unique Index Indexing Registry entry.

  2. The Unique Strict Registry entry must be specified for each of these unique fields (except for IRN).

    Unique Strict specifies whether a field should be checked for uniqueness as a new record is being processed or existing record is being edited. Typically the check occurs as a field is exited (displaying a warning if it is a duplicate), but in the case of the Import Tool, as each record is being processed.

    Note: For multi-column unique values (where a combination of fields is used to specify uniqueness) it is necessary to set Unique in the back-end and specify Unique Strict in the Registry for each of the fields.

This example uses IRN as well as Accession Number to identify records in the Catalogue module and update a located record's Condition fields: if unique fields are specified in the data file and a matching record is identified in EMu, the EMu record is updated.

Note that if a record with a unique field specified in the data file does not exist in EMu, it will be created.

Note: In this example, the updates will only work if Accession Number has been set up as a Unique field in the Catalogue.

Note: Unique fields cannot themselves be updated.

Rules

  1. Where a record in the Import data file matches an existing EMu record and the matching data is in one or more fields configured to be unique (e.g. an IRN), the record is updated.
  2. If a Column Name is included in the Import data file, but no value is associated with it, any existing value in the field will be removed from the matching EMu record when the import is run.

    This can be useful if you wish to clear any existing values from a particular field. However it can be potentially dangerous as you could inadvertently clear a field of any values.

  3. If a record in the Import data file includes a field configured in EMu to be unique (e.g. an IRN) and there is no matching record, a new record is created.
  4. If a record in the Import data file includes a field configured in EMu to be unique (e.g. an IRN) and there is more than one match, an error is generated.
  5. Unique fields cannot themselves be updated.

In this example the fields used are:

Fields

Back-end name

IRN irn
Accession Number TitAccessionNo
Condition Status ConConditionStatus
Date Checked ConDateChecked
Checked By ConCheckedByRef
Condition Details ConConditionDetails