Archibus Web Central
Archibus Smart Client

Importing and Exporting Document Fields (Data Transfer)

If the view that you are importing to includes a Document field with associated documents, the import action imports the documents from server-side folders to the database afm_docs and afm_docvers tables.

When exporting data, if the view includes a Document field, and this field is visible in the view, any document files stored in the afm_docs and afm_docvers tables are saved into specified server folders.

Note: For general information about Data Transfer, see Data Transfer Overview.

Exporting the Inventory, Archibus Documents, and Archibus Document Versions Tables

Exporting the Inventory Table, exports the documents associated with that table. For instance, exporting the activity_log table exports all activity_log documents.

Exporting the afm_docs and afm_docvers table exports the document metadata: descriptions, version descriptions, dates of change, and authors.

Both match up again if they are re-imported into the same database. You can import the documents or the metadata first. It doesn’t matter, since the import rematches them based on their primary key.

If you don’t re-import the metadata, the documents can still be uploaded and downloaded. This condition can happen if you use the Project Update Wizard on the inventory tables, but not on the metadata tables.

Note the following about exporting document files:

Procedure: Importing document fields

Note the following about importing files:


Follow these steps to import document fields:

  1. Export records from the source database
  2. When importing , use the following folder structure and file naming conventions for the files:
    • For the import file: [your_user_name]\dt\[your_csv_file]
      For example: afm\dt\activity_log.csv

    • For the documents associated with the Document (doc field) of the table: [your_user_name]\dt\[your_table_name]\[all_your_image_files_for_the_table
      For example: afm\dt\activity_log\doc4^8665^1^activity_log-8665-doc4.png for a document image file associated with the Action Items table.

  3. Make some change to the records to be imported (for example, a comment change), so Data Transfer recognizes a difference in the record.
  4. Use Data Transfer to import the csv file.

For each subfolder name that is a table name, the application reads all file names in that subfolder.

For each file, the application:

Naming conventions for folders and files

When you export views with documents, follow these conventions:

Folder naming

File naming

Name the files with the primary key parts plus the file name, separating the parts with carats.

Ensure that the file name for each of the documents places the primary key between the Inventory Table Name (table_name) and the Inventory Field (field_name).

For example:

Note: If a file name contains a carat (^) replace that with two carats (^^). This enables the application to distinguish between multi-part keys and the file name itself.

Example

Consider the activity_log table's two document fields: doc1 and doc2.

Following the conventions for directory naming and file naming discussed above, the files would be named and stored as follows: 

Automatically Named Files or Using File Names on the Server

The data transfer process can automatically name files, or instead use the name for the file stored on the server. The method used depends on the schema A/FM field’s definition of the field.

In the cases where the name is automatically generated, the application assigns file names using the following convention:

<table><field><key>.<extension>

For example,

activity_log-doc-305.doc

If you previously imported documents using an older version of Archibus that used a different convention, the files are renamed using the new convention when you check in a new document, or check in revisions to existing documents.

If the file name is not automatically generated based on the schema A/FM field’s definition of that field, data transfer takes whatever file name is on the server and imports it. For example, the following file names are the actual file names on the server:

ConstructionContract_R01.doc and ConstructionContract_R02.doc

Document Version Information

If the document field supports multiple versions, a new record will be generated for each new document version checked in. If the document field does not support multiple versions, the table will contain one record for the single version that is checked in. This will be numbered version 0.

When multiple versions are supported, data transfer automatically updates the version number when documents are imported by incrementing the version number by one. The version number is used by the application to identify the document, so do not remove this number. In the following example, 1 is the version number:

doc^5^1^msds_data-5-doc.pdf