Professional Documents
Culture Documents
Data Warehouse/Analytics
March 2001
1
The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of
the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a
commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of
publication.
This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
AS TO THE INFORMATION IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no
part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any
means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written
permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject
matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this
document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.
The example companies, organizations, products, people and events depicted herein are fictitious. No association with any real
company, organization, product, person or event is intended or should be inferred.
2001 Microsoft Corporation. All rights reserved.
Microsoft, ActiveX, FoxPro, FrontPage, Jscript, Outlook, Visual Basic, Visual C++, Visual InterDev, Visual J++, Visual Studio,
Win32, Windows, and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the United States
and/or other countries.
The names of actual companies and products mentioned herein may be the trademarks of their respective owners.
2
Extending the Commerce Server 2000 Data Warehouse/Analytics
Contents
Extending the Commerce Server 2000 Data Warehouse/Analytics...........................................................1
Contents...........................................................................................................................................................3
Objective..........................................................................................................................................................5
Introduction and Background.......................................................................................................................6
The Commerce Server Data Warehouse....................................................................................................6
Commerce Server Analytics—Basic Architecture and Technical Components........................................8
The Need to Extend the Data Warehouse and Analytics...........................................................................9
Extending Data Warehouse Analytics—Brief Overview........................................................................10
Background Overview of Technical Concepts............................................................................................11
Technical Structure of the Data Warehouse.............................................................................................11
Overview of the Data Warehouse Schema—Logical vs. Physical...................................................11
Logical Schema................................................................................................................................11
Physical Schema/Data Store.............................................................................................................12
The OLE DB Provider for Commerce Server (As the Data Warehouse Manager).................................12
Microsoft OLE DB Technology.......................................................................................................13
OLE DB Provider for Commerce Server—Overview.....................................................................13
OLE DB Provider for Commerce Server—Major Features and Benefits........................................15
OLE DB Provider for Commerce Server—Limitations...................................................................16
Technical Elements..................................................................................................................................16
Classes, Members, and Keys............................................................................................................16
Class and Member Relations............................................................................................................17
Single Instance Creation...................................................................................................................17
ADO and VBScript..........................................................................................................................18
Sample Scenario Definition and Design......................................................................................................19
Overview of the Sample Scenario...........................................................................................................19
The Required End Result for Analysis....................................................................................................19
The Technical Scenario for Data Integration...........................................................................................20
Data Integration Design Details..............................................................................................................20
Development Steps........................................................................................................................................23
Create a New Class..................................................................................................................................24
Add New Members..................................................................................................................................25
Add Relations..........................................................................................................................................26
Import the External Data into the New Class..........................................................................................27
Create a SQL View to Join the Data........................................................................................................29
Create a New Cube..................................................................................................................................30
Create a New Report...............................................................................................................................31
Run the New Report and the Chart from Business Desk........................................................................32
The New Report...............................................................................................................................33
The New Chart.................................................................................................................................34
3
Extending the Commerce Server 2000 Data Warehouse/Analytics
Summary.......................................................................................................................................................35
Appendices.....................................................................................................................................................36
Appendix A: Sample Code—Creating the Schema Objects....................................................................36
Appendix B: Sample Code—Importing Data Using Single Instance Row Insert...................................40
Appendix C: Sample Code—SQL View to Merge the Online and OTC Data........................................42
Appendix D: Sample Code—SQL or XML Code to Create a New Report Definition...........................43
4
Extending the Commerce Server 2000 Data Warehouse and Analytics
Objective
This document provides an in-depth discussion regarding the extensibility features of the
Commerce Server Data Warehouse and Analytics module. The purpose of this document
is to:
• Provide a high-level overview of the technology architecture involved in extending
the Data Warehouse and Analytics to be able to handle the customization
requirements for analysis and reporting.
• Provide an in-depth analysis of the technical components and their interrelationships
and integration.
• Suggest a comprehensive step-by-step methodology to complete the project of
extending and customizing the Data Warehouse and Analytics from start to finish.
• Provide general technical design guidance for planning data integration into the Data
Warehouse.
• Provide sample programs for each step in the development process and drill down
into the code for extending the schema, importing the data, creating the SQL objects,
the cube design, and generating a report and a chart.
5
Extending the Commerce Server 2000 Data Warehouse and Analytics
Interactive
Web Usage
Analysis
Users Targeted
Mail
Transactions Business User Profile
Data Management
Catalog Warehouse
Prediction
Advertisements Clustering
Other Other
6
Extending the Commerce Server 2000 Data Warehouse and Analytics
The Data Warehouse combines data from multiple sources into one common structure,
giving the data consistency for producing reports and analyzing and viewing population
segments. This structure is called the Commerce Server Business Analytics System.
Business analytics is a way of looking at your Web site data to answer specific questions
about the performance of your Web site. You can use the information provided by
business analytics to improve your customer service, target content to users, improve site
performance, and so on.
Business analytics provides you with specific measurements of the performance of your
Web site, such as:
• What URL did the user visit before accessing your site (the referring URL)?
• What type of advertising works?
• What pages are the most popular on your Web site?
• Which products sell the best?
• Which users buy the most?
You can use these measurements to make changes to your Web site that will increase
sales and retain users. For example, assume you display an advertisement to promote a
new product. After the ad is displayed for a week, you can run a report to determine
whether the ad increased sales of the product. If it did not increase sales, you can update
your site, for example, to display a 10 percent discount for the new product. After a week,
you can determine whether the discount improved sales.
The following diagram provides an overview of the various processes in the Data
Warehouse.
WebTV Commerce
data & events CS Data Warehouse VB
DTS Packages
7
Extending the Commerce Server 2000 Data Warehouse and Analytics
Business Desk
Report Reports in IE
Definitions IIS Dynamic Static
Report PivotList HTML Table
Object
Chart Parameters
Data
Source
MS OLAP
SQL Server
Server
List Manager
Export
Obj Direct User
Mail Manager
The key components of Commerce Server Analytics are as follows:
• SQL Server hosts the relational database portion of the Commerce Server Data
Warehouse. The Report table in this database contains the report definitions of the
standard and user-defined reports.
• Microsoft OLAP Server (Analysis Services 2000) hosts the OLAP portion of the Data
Warehouse.
• Microsoft Internet Explorer is a delivery tool that serves the Data Warehouse reports
to the end user. Commerce Server Business Desk is the primary interface for the end
user to perform reporting-related activities.
• Dynamic reports are displayed in Internet Explorer through the Office Web
Component (OWC) using the PivotList ActiveX® control, which connects to the
specific OLAP cube that contains the data for the reports. The OWC enables the user
to dynamically pivot, slice/dice, and drill down the contents of the reports.
• Static reports are displayed in Internet Explorer by using HTML, by means of the
Report Renderer component.
• The contents of a report can be viewed in the graphical chart format by using the
Chart button.
• The export object can be used to export the data to List Manager or to Microsoft
Excel by means of a single button on the displayed report.
8
Extending the Commerce Server 2000 Data Warehouse and Analytics
9
Extending the Commerce Server 2000 Data Warehouse and Analytics
10
Extending the Commerce Server 2000 Data Warehouse and Analytics
DW Technical Architecture
Scripts Campaigns
Commerce Web Log
Users
Events ADO Import Transactions
CS Data Warehouse
SQL
SQL OLA
OLAP
Serve
Server Serve
Server
P
r r
Logical Schema
The logical schema provides an understandable view of the data in the Commerce Server
Data Warehouse and supports an efficient import process. For example, a site developer
uses the logical schema to modify the location of the data stored in the underlying
physical tables. When a site developer writes code to add, update, or delete data in the
Data Warehouse, the developer interacts with the logical schema. When
Commerce Server accesses data in the Data Warehouse, it accesses the data through the
logical schema. Only the site developer needs detailed knowledge of the logical schema.
11
Extending the Commerce Server 2000 Data Warehouse and Analytics
The OLE DB Provider for Commerce Server (As the Data Warehouse
Manager)
This section describes the OLE DB Provider for Commerce Server and its role as the
Commerce Server Data Warehouse Manager. After a brief review of OLE DB technology,
this section provides an in-depth discussion of the features and functionality of the OLE
DB Provider for Commerce Server.
12
Extending the Commerce Server 2000 Data Warehouse and Analytics
13
Extending the Commerce Server 2000 Data Warehouse and Analytics
OLE DB Provider for Commerce Server is the Data Warehouse Manager that controls the
entire logical schema in addition to the persistent physical storage of the Data Warehouse
entities.
14
Extending the Commerce Server 2000 Data Warehouse and Analytics
An OLE DB Provider for Commerce Server is a COM component that accepts calls to
the OLE DB API and processes each request against the data source. The OLE DB
Provider for Commerce Server provides two distinct paths of functionality. The Fastload
property passed in the connection string determines which of these functionalities is used.
The Data Warehouse concentrates on bulk insertion and the ability of the OLE DB
Provider for Commerce Server to automatically instantiate the parent classes when a
child class is created.
OLE DB Provider for Commerce Server
OLE DB Interface
ADO/OLE DB 2.5 Async post
interface
Data queue
Lazy, batched saves
using bulk insert
Summarizatio
Distributed ns
Summarizations Normalization
Optimizes data for and packing
server side processing Async post
Package queue
Send to
Storage
15
Extending the Commerce Server 2000 Data Warehouse and Analytics
Technical Elements
16
Extending the Commerce Server 2000 Data Warehouse and Analytics
17
Extending the Commerce Server 2000 Data Warehouse and Analytics
18
Extending the Commerce Server 2000 Data Warehouse and Analytics
19
Extending the Commerce Server 2000 Data Warehouse and Analytics
Commerce
StageDB
DW
Staging
Database
View
(from ERP)
AllSalesReport
AllSalesCube (custom report)
(new cube)
20
Extending the Commerce Server 2000 Data Warehouse and Analytics
• A new class named OTCStore will be created to host the external data for the OTC
sales from the brick-and-mortar stores.
21
Extending the Commerce Server 2000 Data Warehouse and Analytics
• The following four new members will be created to host the external data:
• OTC_ProductNameCat (for logical key)
• OTC_Date
• OTC_Amount
• OTC_Quantity
• Two new relations for the new OTCStore class will be created to the Products class
and the Date class in the Data Warehouse. This is necessary to establish Referential
Integrity.
• The single instance insert method of the OLE DB Provider for Commerce Server will
be used to import the data from the staging database (StageDB). This will
automatically generate the “Surrogate Keys” (implemented as binary 6-byte id’s in
the Commerce DW) for the newly created instances (rows).
• These binary 6-byte IDs (ProductsID and DateID) will be used as the as the
dimension keys (surrogate keys) when the new cube with the integrated measures is
created.
• The following four columns will be used as the measures for the Fact table (as a SQL
View) used to create the new cube:
• OrderFormLineItems.cy_lineitem_total
• OrderFormLineItems.quantity
• OTCStore.OTC_Amount
• OTCStore.OTC_Quantity
22
Extending the Commerce Server 2000 Data Warehouse and Analytics
Development Steps
The following diagram provides a pictorial overview of the development steps involved
in extending the Commerce Server Data Warehouse schema and the related objects for
the analytics.
Development
Create
Steps Overview a new
class
Add new members
Create to the class
a new
report
23
Extending the Commerce Server 2000 Data Warehouse and Analytics
'---------------------------------------------------------------
'*** Create a new Class
Dim oRec
oRec("GeneratePartitionDef") = 1
oRec("GenerateTableDef") = 1
oRec("GenerateIdentity") = 1 'Identity Member
oRec("__Commit") = 1
oRec.Fields.Update
oRec.close
Set oRec = Nothing
'----------------------------------------------------------------
24
Extending the Commerce Server 2000 Data Warehouse and Analytics
oRec("IsDimension") = 0
oRec("TypeName") = "CURRENCY"
oRec("__Commit") = 1
oRec.Fields.Update
oRec.Close
Set oRec = Nothing
'----------------------------------------------------------------
25
Extending the Commerce Server 2000 Data Warehouse and Analytics
Add Relations
In this step, we create the new Relations that establish the relationships between the new
Class and the two dimension Classes – Date and Product. The following VBScript/ADO
code provides the detailed syntax as an illustrative example. Please note that the sample
code snippet on this page is provided to highlight the nature of the specific code. The
complete working code is provided in the Appendices later in this white paper.
'----------------------------------------------------------------
'***4. Create new Relation to Products Dim -
OTCStoreToProductsRelation
oRec.Fields.Update
oRec.Close
Set oRec = Nothing
'----------------------------------------------------------------
26
Extending the Commerce Server 2000 Data Warehouse and Analytics
dim objConn
dim objRS
dim fld
dim objRec
set objConn = CreateObject("ADODB.Connection")
set objRec = CreateObject("ADODB.Record")
set objRS = CreateObject("ADODB.Recordset")
objRec("__Commit") =1
objRec.fields.update ' Added one record
‘ Not flushed till connection is closed
objRec.Close
objRS.movenext
Wend
27
Extending the Commerce Server 2000 Data Warehouse and Analytics
'----------------------------------------------------------------
28
Extending the Commerce Server 2000 Data Warehouse and Analytics
--------------------------------------------------------------------
---
CREATE VIEW AllSalesView AS
SELECT otc.productsid,
otc.dateid,
otc.otcamount as Amount,
otc.otcquantity as Quantity,
'OTC' as StoreType
FROM otcstore otc
UNION ALL
SELECT o.productsid,
oh.dateid,
o.cy_lineitem_total,
o.quantity,
'OnLine' as StoreType
FROM orderformlineitems o
JOIN OrderFormHeader oh
ON oh.ordergroupid = o.ordergroupid
--------------------------------------------------------------------
--
29
Extending the Commerce Server 2000 Data Warehouse and Analytics
Please note that this new custom cube can be processed automatically as a part of the
“Report Preparation” DTS task. The SQL table CubeProcInfo in the Commerce Server
Data Warehouse database (for example, Retail_DW) contains the list of cubes that the
“Report Preparation” DTS task will process. If the name of the new cube (AllSalesCube)
is added to the CubeProcInfo table by inserting a new row, this cube will be processed
every time the “Report Preparation” DTS task is executed.
30
Extending the Commerce Server 2000 Data Warehouse and Analytics
--------------------------------------------------------------------
--
-- Sample code only. Fully working code including the variable
-- declarations is provided in the Appendix.
31
Extending the Commerce Server 2000 Data Warehouse and Analytics
Run the New Report and the Chart from Business Desk
In this step, we run the new report and the chart from Commerce Server Business Desk.
The following figure provides an overview of the portfolio of standard reports in
Business Desk.
32
Extending the Commerce Server 2000 Data Warehouse and Analytics
33
Extending the Commerce Server 2000 Data Warehouse and Analytics
34
Extending the Commerce Server 2000 Data Warehouse and Analytics
Summary
The following list briefly summarizes the key features and functionality of
Commerce Server 2000 Data Warehouse and Analytics that this paper has covered:
• Commerce Server 2000 uses an extensible schema based on the OLE DB technology
that can be used for new subject area integration (for example, ERP, CRM, and so
on).
• The OLE DB Provider for Commerce Server serves as the Data Warehouse Manager
and automates many important functions of the Data Warehouse.
• The OLE DB Provider for Commerce Server supports efficient and easy data loading.
• The schema extensions can be used for creating more effective OLAP cubes with
integrated information.
• The schema extensions can be used for creating extensible, flexible, and powerful
custom reports tailored to ever-changing business and customer requirements.
Several key Microsoft independent software vendors (ISVs) have created value-added
solutions for additional metrics and reports—based on the Commerce Server Data
Warehouse—that provide more effective analytics for Commerce Server.
35
Extending the Commerce Server 2000 Data Warehouse and Analytics
Appendices
'----------------------------------------------------------------
' This program provides the sample code for extending the
' Commerce Server Data Warehouse schema by means of the
' OLE DB Provider for Commerce Server and
‘ the ADO API using the VBScript language.
' This program creates a new Class, adds new Members, and then
' adds new Relations for the new Class to the existing Classes in
' the Data Warehouse schema.
'----------------------------------------------------------------
'***1. Set connections
'----- Set Provider connection -----
'ADO 2.5 connect string
strURL =
"URL=mscop://InProcConnect/Server=<server1>:database=retail_dw:catal
og=DWSChema:user=sa:password=:FASTLOAD=True"
Dim oCn
Dim oCmd
'-------------------------------------------------
' Turn on schema change mode
'------------------------------------------------
oCmd.CommandText = "SchemaMode=1"
oCmd.Execute
'---------------------------------------------------------------
'***2. Create a new Class
Dim oRec
36
Extending the Commerce Server 2000 Data Warehouse and Analytics
oRec("GeneratePartitionDef") = 1
oRec("GenerateTableDef") = 1
oRec("GenerateIdentity") = 1 'Identity Member
oRec("__Commit") = 1
oRec.Fields.Update
oRec.close
Set oRec = Nothing
'----------------------------------------------------------------
'***3. Create new Members
oRec("IsDimension") = 0
oRec("TypeName") = "CURRENCY"
oRec("__Commit") = 1
oRec.Fields.Update
37
Extending the Commerce Server 2000 Data Warehouse and Analytics
oRec.Close
Set oRec = Nothing
oRec("IsDimension") = 0
oRec("IsMeasure") = 1
oRec("TypeName") = "LONG"
oRec("__Commit") = 1
oRec.Fields.Update
oRec.Close
Set oRec = Nothing
'----------------------------------------------------------------
'***4. Create new Relation to Products Dim -
OTCStoreToProductsRelation
oRec.Fields.Update
38
Extending the Commerce Server 2000 Data Warehouse and Analytics
oRec.Close
Set oRec = Nothing
'----------------------------------------------------------------
'***5. Create new Relation for Date Dim - OTCStoretoDateRelation
oRec.Fields.Update
oRec.Close
Set oRec = Nothing
'-------------------------------------------------
' Commit Schema
'-------------------------------------------------
oCmd.CommandText = "CommitSchema"
oCmd.Execute
'-------------------------------------------------
' Turn off schema change mode
'------------------------------------------------
oCmd.CommandText = "SchemaMode=0"
oCmd.Execute
'---------------------------------------------------------------
39
Extending the Commerce Server 2000 Data Warehouse and Analytics
'----------------------------------------------------------------
'***1. Set connections
dim objConn
dim objRS
dim fld
dim objRec
objRec("ProductNameCat") = objRS.Fields("stg_ProductNameCat")
objRec("DTimeStamp") = objRS.Fields("stg_Date")
objRec("OTCAmount") = objRS.Fields("stg_Amount")
objRec("OTCQuantity") = objRS.Fields("stg_Quantity")
40
Extending the Commerce Server 2000 Data Warehouse and Analytics
objRec("__Commit") =1
objRS.movenext
Wend
'----------------------------------------------------------------
41
Extending the Commerce Server 2000 Data Warehouse and Analytics
Appendix C: Sample Code—SQL View to Merge the Online and OTC Data
--------------------------------------------------------------------
---
CREATE VIEW AllSalesView AS
SELECT otc.productsid,
otc.dateid,
otc.otcamount as Amount,
otc.otcquantity as Quantity,
'OTC' as StoreType
FROM otcstore otc
UNION ALL
SELECT o.productsid,
oh.dateid,
o.cy_lineitem_total,
o.quantity,
'OnLine' as StoreType
FROM orderformlineitems o
JOIN OrderFormHeader oh
ON oh.ordergroupid = o.ordergroupid
--------------------------------------------------------------------
--
42
Extending the Commerce Server 2000 Data Warehouse and Analytics
--------------------------------------------------------------------
---
-- Use this script to create a new dynamic OLAP report in the
-- Commerce Server Data Warehouse
-- More detailed instructions are in the SDK
-----------------------------------
-- To Create the Report Definition:
-----------------------------------
-- Replace the Report Name, Description, Report Category,
-- and Report Creator strings below.
-- Replace 'AllSalesCube' with the desired cube name
-- as the datasource.
-- Run this script on your Data Warehouse (for example, Retail_DW).
-- Now you have created the report definition for the new report.
---------------------
-- To Run the Report:
---------------------
-- In Commerce Server Business Desk, go to the Analysis reports
module.
-- If the new report does not appear, execute a find for 'All
Reports'
-- to refresh the list.
-- Select the new report and run it.
-- Select dimensions and measures from PivotTable Field List to
create
the desired view.
-- Press the Save button to save the new report.
------------------------
-- Report Constants
------------------------
-- ReportType
Declare @Dynamic_MDX tinyint
Select @Dynamic_MDX = 1
------------------------
-- Report Variables
------------------------
43
Extending the Commerce Server 2000 Data Warehouse and Analytics
44