CloseAggregationsAnalysis (clsPartitionAnalyzer)

Analysis Services Programming

Analysis Services Programming

CloseAggregationsAnalysis (clsPartitionAnalyzer)

The CloseAggregationsAnalysis method of an object of ClassType clsPartitionAnalyzer closes the partition analyzer session and clears the temporary objects used during the analysis.

Syntax

object. CloseAggregationsAnalysis

object

The object of ClassType clsPartitionAnalyzer used to perform the analysis.

Remarks

This method does not permanently save the DesignedAggregations collection in the partition. It clears the temporary objects used during the analysis. If you want to save the results from a partition analyzer session you must do so programmatically. The sections in the following example show how to save the results of an analysis in the partition.

Example

Use the following code to run several analysis steps, save the results, and close the analysis. The analysis continues until one of the following goals is reached:

  • Twenty or more aggregations are designed.

  • The storage requirements for the designed aggregations exceed 100,000 bytes.

For more information, see InitializeDesign.

' Assume the existence of an object (dsoPart) of ClassType
' clsPartition and an object (dsoPartAnalyzer) of ClassType
' clsPartitionAnalyzer.
Private blnStopAdding      As Boolean
Dim dblPercentageBenefit   As Double
Dim dblAccumulatedSize     As Double
Dim lngAggregationsCount   As Long

dsoPartAnalyzer.InitializeDesign

' Iterate through analysis until either goal is reached.
Do Until blnStopAdding  
    If Not dsoPartAnalyzer.NextAnalysisStep(dblPercentageBenefit, _
    dblAccumulatedSize, lngAggregationsCount) Then
        blnStopAdding = True ' No new aggregations designed.
    Else
        blnStopAdding = (lngAggregationsCount >= 20) Or _
        (dblAccumulatedSize >= 100000)
    End If
Loop

' Delete existing aggregations.
Do While dsoPart.MDStores.Count
    dsoPart.MDStores.Remove 1
Loop

' Add designed aggregations to partition.
For Each Agg In dsoPartAnalyzer.DesignedAggregations
    dsoPart.MDStores.Add Agg
Next Agg

dsoPartAnalyzer.CloseAggregationsAnalysis  'Close the analysis.

See Also

clsAggregation

clsPartition

clsPartitionAnalyzer