MS Excel data import
- Tom Wyczółkowski
- Maciej Zabielski
- Martin SWG (Unlicensed)
Excel .zip package for import
.Zip package structure
.zip package content should contain in it's top level one directory containing the following:
- Style-sheet file .xlsm
- Folder representing the top hierarchy level class, that was mentioned (by column name) in style-sheet file.
For example in sample package, we have stylesheet "METADATAREG_Hamnen11- 12.xlsm" and top level class is Fastighet.
Excel stylesheet
Calculating path to imported file from stylesheet
Zip package should contain folder structure and files that are to be imported.
Folder structure and file names should correspond to specific column names in xls stylesheet:
- Sökväg - relative path (to excel file) pointing folder holding files to import.
- Filnamn - name of a file to import in folder in path pointed in Sökväg column.
- Ext - extension of file pointed in Filnamn column.
[Sökväg] \ [Filnamn] [Ext.] example: [Hamnen 11-12\Arkitekt\Raster] \ [10000086] [.cal]
In order we want to xls-import files placed in zip package, all these columns have to be set for every document object that is to be imported.
External Domain configuration guide
- Create external domain Excel
- All classes mentioned (by column) in stylesheet file should be added to external domain configuration with it's identifier fields specified in class fields tab.
- For class mentioned only by column in XLS stylesheet (like Fastighet), the name of the identifier is not relevant, one can assume that it is objectId - matching is done by HDC label field.
- Excel column Dokumenttyp states what document class are imported - this class should be added to External Domain.
important
For document classes, that have rows indicating document objects listed in xls stylesheet, identifier field should be Filnamn.
Sample domain configuration for external class 'Fastighet'
Object classes tab
Following example shows all classes required for import based on "METADATAREG_Hamnen11- 12.xlsm" stylesheet
Object Mapping tab.
One has to remember to add mapping to all required fields from source class fields.
In case of Excel import, mapping will not be used to identify objects . Since Excel file does not contain any ID's that are unique or known to HDC, values from Excel columns such as Hus/Bygnad etc must match HDC object's label field.
Object Identity (TOBIS) tab
One has to remember to specify Identity fields for all imported classes and it''s required hierarchy.
Importing process
Upload of excel .zip package
Upload is performed in general way via Upload button.
Choose XLS Type of Import.
Import documents from excel package
- Create needed Tree objects (in our example Fastighet, Hus and Plans are needed)
Go to Import Panel and fill in Import form
Root object ID and class should point to object in Tree Perspective that is a parent for Top level object of Import (in our example parent for Fastighet)
- Click Import button and check result on Import Log tab
Troubleshooting
- Most common situation is when Document to be imported from XLS stylesheet cannot be connected to target object in Tree as this object is not present in target DB.
Such situation will Result in import status Finished with Errors. In reports section on, Objects tab those not imported documents will be listed.
Error message will be provided with name of object that was not found in database.
Error reported is
Hierarchy matching for object failed during matching: id Rotundan 3/Byggnad 1/Plan 01 - KV -3TR, source class 105 and destination: id 006537225584, destination class 110
That means that document of external ID 006537225584 (HDC destination class 110) cannot be linked to object of class 105 that have path Rotundan 3/Byggnad 1/Plan 01 - KV -3TR in Perspective used for import. In this case Floor Plan 01 - KV -3TR did not exist.
- TOBIS Field not set for class - this will be reported in Unmatched tab
- Objects present in XLS sheet but without mapping in domain configuration - will be will be reported in Unmatched tab.
- Document added but content not attached. This can happen when path to file (that consist of 3 columns in excel) is not fully filled.
Such situation will be visible both on Objects and Unmatched tab of import reports.
Supported XLS stylesheet format is .xlsm.
Sample package: sample_package.zip
To see imported documents please remember to choose correct Perspective Set with appropriate Perspectives and its available classes.