Analysis Services

Changing Properties of an Analysis Services Processing Task

You can change some properties of an Analysis Services Processing task by including in its package a Microsoft® ActiveX® Script task that executes before the Analysis Services Processing task. The ActiveX Script task can change property values every time the package is executed or it can change them depending on conditional logic. An ActiveX Script task that updates properties for every execution is particularly useful prior to an Analysis Services Processing task that performs incremental updates of a cube or partition. These incremental updates usually require that the filter or fact table be changed for each package execution.

After you add the two tasks to a package and connect them with a success precedence constraint, the Data Transformation Services (DTS) Designer design sheet looks like this:

The following properties of the Analysis Services Processing task can be changed. Note that all property names are case sensitive.

In addition to specifying properties and their values, the ActiveX Script task must name the Analysis Services Processing task to change. Task names are displayed in the Analysis Services Processing Task dialog box.

The following example shows how the task name DTSTask_DTSOlapProcess.Task_1 is used to indicate which Analysis Services Processing task is changed.

Example

The following code, written in Microsoft Visual Basic® Scripting Edition, is used in an ActiveX Script task that modifies the properties of an Analysis Services Processing task. The Analysis Services Processing task incrementally updates the sample Sales cube included in Microsoft SQL Server™ 2000 Analysis Services. The incremental update is executed monthly throughout 1998 except in December.

The code selects a fact table different than the original fact table for the Sales cube (sales_fact_1997). It also creates a different filter each month.

Note  The code specifies the sales_fact_1998 fact table in the sample FoodMart 2000 database. This table includes data for only 1998 (except December). Before executing the package containing this code, set your computer's clock to a date between January 1, 1998 and November 30, 1998. Immediately after the package executes, reset the clock to the current date.

Function Main()
   Dim pkg
   Dim task
   Dim props
   Dim currentyear
   Dim currentmonth
   Set pkg = DTSGlobalVariables.parent
   Set task = pkg.Tasks("DTSTask_DTSOlapProcess.Task_1")
   Set props = task.Properties
   props("ProcessOption").Value = 2
   props("Datasource").Value = "FoodMart"
   props("FactTable").Value = "sales_fact_1998"
   ' Create filter based on current year and month.
   currentyear = YEAR(NOW)
   currentmonth = MONTH(NOW)
   props("Filter").Value = "([sales_fact_1998].[time_id] " _
       & "IN (SELECT [time_id] FROM [time_by_day] " _
       & "WHERE [time_by_day].[the_year] = " _
       & currentyear  _
       & " AND [time_by_day].[month_of_year] = " _
       & currentmonth & "))"
   Main = DTSTaskExecResult_Success
End Function
 

After the incremental update is complete, you must merge the selected rows from sales_fact_1998 into sales_fact_1997. For more information, see Fact Table Considerations When Merging Partitions.

See Also

ActiveX Script Task

Creating an Analysis Services Processing Task

Processing Cubes