Scripting the Report Preparation DTS Task

The following script creates and runs the Report Preparation DTS task. This script can be used to create a package containing the DTS task to be run. The sample script can be run in two different ways. You can run the package on the command line by using the command DTSRun.exe. The file DTSRun.exe is automatically installed on your server when you install SQL Server. Or you can copy the script into a Visual Basic script file (.vbs) and run it by using cscript, for example, <drive>:cscript <filename>.vbs.

To successfully complete the import of data into the Data Warehouse, run the DTS tasks in the following order:

  1. Configuration Synchronization
  2. Web Server Log Import
  3. Transaction Data Import
  4. Product Catalog Import
  5. Profile Data Import
  6. Campaign Data Import
  7. Data Deletion
  8. Model Builder
  9. IP Resolution
  10. Report Preparation
  11. Report caching

For more information about the DTSPostImport object, see DTSPostImport Object.

For a description of this DTS task, see Commerce Server DTS Tasks.

Ee823651.note(en-US,CS.20).gifNote

The Report Preparation task should be run after all data for all the Web sites sharing the Data Warehouse has been imported into the Data Warehouse. You should not run the task for each Web site in the Data Warehouse.

'*********************************************************************
' Report Preparation DTS Task
' This script creates a DTS package and runs it.
'**********************************************************************
Dim oPackage As DTS.Package
Dim oTask As DTS.Task
Dim oStep As DTS.Step
Dim oTaskProps As Object

'******************************************************************
' Define package properties.
'******************************************************************
Set oPackage = CreateObject("DTS.Package")
oPackage.FailOnError = True 
oPackage.Name = "Report Preparation DTS Task"
oPackage.Description = "Populates OLAP cubes with the import data, prepares the data for report generation, and refreshes the cubes after a deletion."

'******************************************************************
' Create a task.
'******************************************************************
'Make sure you are passing the correct ProgID.
Set oTask = oPackage.Tasks.New("Commerce.DTSPostImport")
oTask.Name = "Task1"
oTask.Description = "Creates a task for PrepareRport DTS"
Set oTaskProps = oTask.Properties

oTaskProps("SourceName").Value = "DataWarehouse 1"
' Set the Processing Type to 1 for full import, 2 for refresh, 
' or 100 for Incremental
oTaskProps("ProcessingType").Value = 1
oTaskProps("TaskName").Value = "Task1"
oTaskProps("NumRetries").Value = 1
oTaskProps("RetryInterval").Value = 30

oPackage.Tasks.Add oTask

'******************************************************************
' Create a step.
'******************************************************************
Set oStep = oPackage.Steps.New
oStep.Name = "Step1"
oStep.TaskName = "Task1"

oStep.ExecuteInMainThread = True
oPackage.Steps.Add oStep

'******************************************************************
' Execute the package.
'******************************************************************
oPackage.Execute

    For I = 1 To oPackage.Steps.Count
        If oPackage.Steps(I).ExecutionResult = 1 Then
            iStatus = False
            MsgBox oPackage.Steps(I).Name + " in the " + _
            oPackage.Name + " failed."
        End If
    Next 

MsgBox oPackage.Name + " Done"

Set oStep = Nothing
Set oTaskProps = Nothing
Set oProps = Nothing
Set oTaskProps = Nothing
Set oPackage = Nothing

Copyright © 2005 Microsoft Corporation.
All rights reserved.