Kentico CMS 7.0 Developer's Guide

Final steps

Final steps

Previous topic Next topic Mail us feedback on this topic!  

Final steps

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

In this topic, you will find information on the final steps of the Kentico Import Toolkit wizard. To learn about the preceding steps, refer to the Initial steps topic and the topics about data selection for import from an MS SQL database, XML file or CSV and XLSX files.

 

7. In Step 5, you can see a preview of the data to be imported. This step is only informative and you can use it to check if you specified the source data correctly in the previous steps.

 

devguide_clip1980

 

Click Next to proceed to the next step.

 

8. In Step 6, perform mapping of source fields to target fields. The utility automatically recognizes fields that appear to be equivalent, so if names of the fields or at least their suffixes match, most of the fields should be mapped automatically. You then only need to check and fine‑tune the mappings. If you want to return to the default mappings after adjusting them, click Reset to default mappings above the grid.

 

The mappings grid contains the following columns:

 

Target field - field of the target object/document into which the data should be imported. If you turn on the Show advanced columns check-box above the grid, additional columns that you typically wouldn't use as an import target are offered as well.

Required - indicates if the target field is required.

Source field or expression - source field from which data will be imported into the target field. You can use the following expressions in the text to get the values dynamically:

=macroexpression - evaluates the specified macro expression using the source data and uses its result in the value. For example, ={%ItemText%} - {%ItemOrder%}.

#<source>query - executes a query against the source database and uses the result in the field. For example, #<source>SELECT TOP 1 UserID FROM CMS_User WHERE UserName ='{%SourceUserName%}' .

#<target>query - executes a query against the target database and uses the result in the field. For example, #<target>SELECT TOP 1 ... .

#<file> - you can specify a file using a URL or a disk path. Binary data of the file will be used as the value of the target field.

Default value - value that is used if the source field does not contain any value (or when its value is NULL).

FK mapping file - you can specify an .fkmap file from a previous export session which converts an ID field to a new field mapped in the previous session. See the following text for more details.

 

If you selected to skip or overwrite existing objects in Step 2 of the wizard, you can specify a WHERE condition in the field below the list. Based on this, the existing objects to be skipped or overwritten will be identified.

 

When importing the data as documents, you can see an extra field below the grid. Use the field to specify the path or NodeID of the document under which you want to create the imported documents. When importing the data as document attachments, there is also an extra field below the grid. In this case, you need to specify the path to the document to which you want to attach the imported attachments.

 

 

InfoBox_Tip

 

Importing new culture versions of an existing document

 

If you wish to use the import toolkit to add language versions to an existing node in the content tree, you also need to specify the appropriate NodeID using the extra field. This can be done through the following expression:

 

#<target>SELECT TOP 1 NodeID FROM View_CMS_Tree_Joined WHERE NodeAliasPath ='{%NodeAliasPath%}'

 

As described for the Source field or expression fields above, the #<target> query is used to select the NodeID of the document that should be updated from the target database.

 

The {%NodeAliasPath%} macro is resolved into the alias path of your document versions in the source data. Because all language versions of the same document share the same alias path, this allows you to find the appropriate NodeID in the target database.

 

Please note that the Import new and overwrite existing documents option must be selected in step 2 of the wizard in order for this to work correctly.

 

You can also enable the Save the old ID to new ID mappings to file check-box. This enables you to save mappings of source ID columns to target ID columns into an .fkmap file that can be used during another session in the FK mapping file column above. The following example explains the use of the file:

 

You have a list of questions and a list of answers, where each answer is bound to a question with a foreign key.

You want to import both lists and preserve their bindings.

First, import the questions and save the ID mapping to a questions.fkmap file.

Then import the answers and use the questions.fkmap file in the FK mapping file column of the field that contains the foreign key.

 

devguide_clip1983

 

Once you have the mappings specified, click Next to proceed to the following step.

 

9. In Step 7, you can see a preview of the data as it will look when imported to the target. Before proceeding, you can choose how you want the data to be imported:

 

Import the data - imports the specified data into Kentico CMS.

Only simulate the import (does not commit the changes) - performs the import to validate that the data is correct, but does not commit the changes to the database.

 

devguide_clip2002

 

After making your choice, click the Import data button to perform the import.

 

10. A log will be displayed, showing you the progress of the import.

 

devguide_clip1986

 

11. If an error occurs during the import, e.g., when there are restricted characters in imported data, the dialog that follows is displayed. The dialog displays an error message explaining the issue and provides you with the following options:

 

Abort - aborts the whole import process.

Retry - you can correct the data in the displayed row and click this button to import the corrected data — without the need of going through the import process again.

Ignore - the current record will be skipped and not imported.

Ignore all - all records containing errors will be skipped during the rest of the import.

 

devguide_clip1985

 

12. The final step informs you of the results of the import. Imported data should already be visible in Kentico CMS at this point. You can perform the following actions:

 

Save log - saves the import log created while the import was being performed.

Import other data to the same project - redirects you to Step 2 of the wizard where you can select object type to import for the same target project.

Start new import session - redirects you to Step 1 of the wizard where you can start a new import session.

Close the import tool - closes the utility.

Go back to the mappings and try import again - this options becomes available if you selected the Only simulate import option in Step 7 or if you chose to Abort the import process.

 

devguide_clip1987