6. New features in Import
Just as we provided a number of options in Export , we have provided a similar number of options for Import.
1. Importing from client machines: The Commerce Server 2007 catalog system now allows you to import data from client machines. The client side import functionality has been built in the catalog system and you don't need to install additional external assemblies. The import can be done over the catalog web service in a secure and performant manner.
2. Import Modes: There are two modes for import
a. In the Full mode if the catalog already exists in the catalog system then it will be deleted and its contents will be replaced by the contents of the catalog in the xml file. This operation is equivalent to deleting the existing catalog and creating a new one from the xml file.
b. In the Incremental mode if a category, product or variant exists in the xml file and the catalog system then the catalog item will be updated. If the catalog item does not exist in the catalog a new one will be created. All other items will be preserved. Items marked for deletion in the xml file will also be deleted from the catalog system.
3. Operations: In this release we have simplified way xml files can be imported and validated. You can
a. Validate, an xml file in which case the file will be parsed, validated and errors reported through the status reporting mechanism.
b. Import, an xml file in which case the file will be imported and errors reported through the status reporting mechanism.
c. ValidateAndImport, allows you to first validate the xml file and if the file is valid it will be imported. If there are errors in the file then the import will not happen.
4. Importing selected catalogs: You can now specify a selected list of catalogs you want to be imported from the file.
5. Importing selected properties: Just as you can specifiy a list of catalogs to import, you can also specify a set of properties to import. A typical scenario is where you want to import a file but don't want the list price of the products to be imported.
6. Transactioning the import process: You can now transact some of the key elements during import. There are two modes
a. Non transactional: In this mode individual elements in the xml file like catalog, category, product, variant etc will be transacted. However failure in importing a single category will still cause the rest of the catalog iyems to be imported.
b. Transactional: If you want to ensure that all elements in a catalog should be imported successfully or none at all then you can use the transactional mode. In this mode importing an entire catalog element (all category, product and variant elements ) will be transacted. A failure in importing a single category, product and variant element will rollback all imports on that catalog. Note that this option applies to individual catalog elements and not the entire xml file.
Irrespective of the above modes importing the CatalogSchema element is transactional. failure to import a single property, definition will abort the import and rollback any changes.
7. Importing schema changes: We now allow you to import an xml file where the catalog schema in the xml file does not match the catalog schema in the catalog system. In this mode any changes made to the catalog schema in the xml file will be made to the schema in the catalog system. For eg suppose that you have a Definition named book in the catalog system containing properties name and author. If you import an xml file containing a definition named book with properties name and writer then importing the xml file with schema changes will change the book definition in the catalog system be deleting the author property from and adding the writer property to the book definition. When doing this operation values assigned to the author property of the book definition in existing catalogs will be lost.
Note that not all types of schema changes are permitted. For eg a language sensitive attribute of a property cannot be changed. Similary the data types of the properties should be compatible. For eg changing the data type of a property from integer to datetime is not permitted. However changing the datatype from integer to biginteger and changing the datatype from biginteger to integer (provided that there is no loss of existing catalog data) is permitted.
8. Restricting the number of errors and aborting import: You can now control the number of errors that can occur before the import operation is terminated. The default value is 100 which means that if the import process encounters 100 errors the import will be terminated.
9. Updating fulltext indexes: This option allows you to control if full text indexes on the catalog should be updated after the import is done.Since updating the full text indexes is a CPU intensive operation you can delay these updates to occur during downtime.
10. Maintaining existing hierarchy and relationships: When importing a catlaog in an incremental mode, you now have an option to retain existing hierarchy and relationships for the catalog items being imported. For eg consider a product "My story" which has a parent category "Biography" and is related to another product "My autobiography" in the books catalog . Now if you are importing the books catalog from the xml file and the product "My story" has a parent category "Autobiography" and is related to "My autobiography 2" you have an option to specify that importing the product will delete or retain the existing hierarchies and relationships for the product. If you choose the delete option the the imported product will have the parent category "Autobiography" and will be related to "My autobiography 2". If you choose the retain option the the imported product will have the parent categories "Biography" and "Autobiography" and will be related to "My autobiography" and "My autobiography 2".
11. Filtering products to import: When importing in incremental mode, you can also control which products to import from the xml file and which products to update in the catalog system. This is achieved by using the LastModifiedDate option. When you set the LastModifiedDate option then the catalog system will not attempt to import products and categories in the xml file having a lastModifiedDate attribute which is less than the specified LastModifiedDate option. Also the catalog system will not update a product if it has been modified after the specified LastModifiedDate option. This is to ensure that changes made to the products in the catalog system are not overwritten inadvertently by the import process.Note that when using this option all product and category elements in the xml file should have the lastModifiedDate attribute. Absence of this attribute will be treated as an error.
12. Importing the last modified date values from the xml file: When importing an xml file the import process will set the lastmodifieddate property of the products and categories to the value of the corresponding lastmodifieddate attribute in the xml file. If the lastmodifieddate attribute is missing then the current datetime will be used.
13. Status reporting: This is a new addition in CS 2007. All long running operations like import, export and virtual catalog rebuilds now report current status of the operation in terms of the percentage of the operation completed.
14. Cancelling an import operation: You can now cancel an import operation.
15. Marking a catalog item as ready for export : In LOB adapter and staging scenarios where you are using import/export to synchronize changes in your catalog systems you need to control if importing a catalog item should signal the product to be ready for export to another system. You can use the ExportReady option to signal if the exportready flag of a catalog item should be set.
As you can see there are a number of options which allow you to control how your information is imported and updated.
While we added a number of cool features in CS2007 we also dropped a couple of features from CS2002.
1. If you remember CS2002 allowed importing xml files in the elementcentric format. We have now dropped importing catalog data in the elementric centric format. We will however provide a script which will allow you to import these types of xml files. You should however note that the element centric format is now deprecated.
2. We no longer support importing catalog data from CSV files. This might be provided as an SDK tool in the future.