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.