Delen via


The new catalog system in Commerce Server 2007 ... Part II

5. New features in Export

Import/Export is one of the features we took a new look at in Commerce Server 2007, studied customer feedback and came  up with a number of configurable options which should address most of typical scenarios like staging, LOB adapters, trading partners etc. These are the things you can do with export

1.Exporting to client machines: The 2007 catalog system now allows you to export data to client machines. In addition to catalog data you can now export catalogset and inventory information. The client side export functionality has been built in the catalog system and you don't need to install additional external assemblies.

2. Modes: The catalog system now allows you to export all your catalog data (Full mode) or you can specify which data should be exported by specifying an expression(Expression based mode). The expression based export can be further fine grained based on other options discussed later.

3. Exporting empty values: By default empty (null or empty) values for a property are not exported. You can use this option to specify that properties whose value is null or empty should also be exported.

4. Exporting deleted items: The catalog system keeps track of products and categories deleted from individual catalogs. You can use this option to export these deleted items to your xml file. This option is particularly useful if you want to use import/export for staging data from staging to production servers and delete catalog items deleted from your staging server on your production server.

5. Specify catalogs to export: You can now specify a list of catalogs to be exported. If not specified all base and virtual catalogs will be exported.

6.Specify properties to export:  Similar to specifying catalogs to export you can also specify which of the category and product properties you want to be exported to the xml file. This option is particulary useful if you want to send xml files to your vendors but dont want competitive data like list price, quantity etc to be exported to the xml file. 

7. Controlling data to be exported: As I noted in point 2, you can now use expressions to control which data should be exported. If you look at the CatalogExportOptions class, you will see that there are three properties on this class which allow you to control this behavior. The ProductsAndCategoriesClause  allows you to specify an expression which will be applied on each catalog that being exported. For eg this clause can be something like "IsActive=1 and Lastmodified > '2006/03/03' " which means export all the catalogs items which are active and which have been modified after '2006/03/03'.

The FilterDescendantsClause allows you to specify an additional clause which will be applied to the results of the ProductsAndCategoriesClause. Extending the above example and specifying "cy_list_price> 99" for the FilterDescendantsClause means export all the catalog items which are active and have been modified after '2006/03/03' and which have a list price greater than 99 dollars.

The FilterDescendantsClause allows you to specify an additional clause which will be applied to the results of the ProductsAndCategoriesClause. There is a third option which allows you to control the set of records on which the FilterDescendantsClause will be applied. This is the Descendants option and it has three values

            a. None : means that the FilterDescendantsClause will be applied on the records that are obtained by applying the  ProductsAndCategoriesClause.

            b. ImmediateChildren : means that the FilterDescendantsClause will be applied on the records that are obtained by applying the  ProductsAndCategoriesClause and the immediate ( first level ) children  of these records .

            c. All : means that the FilterDescendantsClause will be applied on the records that are obtained by applying the  ProductsAndCategoriesClause and all the (descendant) children of these records .

The algorithm for this is something like:

   1. Apply the ProductsAndCategoriesClause on the catalog.

   2. If Descendants = ImmediateChildren then get all the immediate children of the records obtained in step 1 else if Descendants = All then get all the descendants of the records obtained in step 1.

   3. Apply the FilterDescendantsClause on the records obtained in step 2. These will the items that will be exported

      Let's consider an example to make this less confusing. Suppose that you have the following hierarchy in a base catalog:

Category ProductId VariantId IsActive cy_list_price Parent
Category1     1 10  
Category2     1 99 Category1
  ProductFamily1   1 55 Category2
  ProductFamily1 Variant1 0 57 ProductFamily1
  Product1   0 89  
  Product2   1 85 Catgeory1
  Product3   0 45 Category2

1. ProductsAndCategoriesClause = "cy_list_price <59" ,  FilterDescendantsClause = "IsActive=1", Descendants=None. The ProductsAndCategoriesClause will select Category1, Productfamily1  and Product3. Since descendants is none the FilterDescendantsClause will be appied to the above three items and since Product3 is not active only category1 and  Productfamily1 will be exported.

2.ProductsAndCategoriesClause = "cy_list_price <59" ,  FilterDescendantsClause = "IsActive=1", Descendants=ImmediateChildren. The ProductsAndCategoriesClause will select Category1, Productfamily1  and Product3. Since descendants is ImmediateChildren the immediate children of   Category1, Productfamily1  and Product3 viz. Category2 and  Variant1 will also be selected as records to apply the FilterDescendantsClause on. This will result in Category1, Productfamily1 and Category2 to be exported.

3. ProductsAndCategoriesClause = "CategoryName='Category1'" ,  FilterDescendantsClause = "IsActive=1", Descendants=All. This means export all the descendants of Category1 which are active.

As you can see a combination of these three options provide for any set of records to be exported from the catalog.

8. XSD support: In addition to exporting catalog data the catalog system now allows you to export an xsd representation of the catalog xml schema. You can use this option to export an xsd. This will help you generate your own catalog xml files that confirm to the catalog xml schema. This will help you transfer data from external tables to the commerce server catalog system.

9. Controlling exporting of the catalog schema: The catalog xml file contains a CatalogSchema element which contains the properties and definitions used in the catalog system.By default the entire schema will get exported to the xml file. However you can now control how the schema is exported to the xml file using the SchemaExportType option

   a. All, is thedefault and will export the entire schema to the xml file

   b. None, will not export the CatalogSchema element to the xml file.

   c. Relevant, will export only the schema contained in the catalogs being exported to be exported to the xml file. For eg if there are two product definitions Books and CDs in your system and you only want to export the Books catalogs then using the Relevant option will export only the Books definition in the xml file.

10. Exporting virtual catalogs as virtual catalogs: Unlike CS 2002, you can now export a virtaul catalog as a virtual catalog. In this mode the XML file will contain a representation of the inclusion, exclusion and price rules in the virtual catalog. In addition you also have an option to export a virtual catalog as a base catalog wherein the contents of the virtual catalog will be exported in a base catalog format. This effectively converts your virtual catalog to a base catalog.

11. Exporting dependent base catalogs: Complementing option 10 is snother option for virtual catalogs which allows you to specify that when you export a virtual catalog, export the virtual catalog and also the base catalogs included in the virtual catalog.

12. Exporting catalogsets: You now have an option to export catalogsets to your xml file.

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.The export can also be performed in a synchronous mode.

14. Cancelling an export operation : New in CS 2007 is the ability to cancel an export operation.

As you can see there are a number of options which allow you to control how your information is exported. This opens a number of scenarios like staging data from staging to production servers, sending xml files to trading partners, allowing customers to download your catalog information using the web service in a secure and performant manner.

As you will notice the new Staging and LOB adapters that we introduced in CS2007 heavily rely on the import/export features of the catalog system.

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 exporting catalog data in elementcentric and attributecentric formats. We have now dropped exporting catalog data in the  elementcentric format. The reason behind this was that the elementcentric format was used mostly in CS2000 and does not work well with schema validators.

2. We no longer support exporting catalog data to CSV files.

Comments

  • Anonymous
    March 05, 2006
    Commerce Server 2006 offers the following major enhancements to the catalog system since Commerce Server...
  • Anonymous
    March 06, 2006
    Vinyak,

    There was mention of an enhancement in multi-currency handling in one of Ryan's presentations.  Can you speak to how the catalog system has been enhanced for multi-currency support?

    Thanks,
    Colin
  • Anonymous
    March 06, 2006
    Just as we provided a number of options in Export&amp;nbsp;, we have provided a similar number of options...
  • Anonymous
    May 30, 2006
    Virtual catalogs is a key feature we improved upon in Commerce Server 2007 to allow you to further customize...
  • Anonymous
    June 07, 2006
    The catalogsets feature is probably the least known feature in the catalog system.&amp;nbsp;Unlike in previous...