Merge

The Merge method of the MDStore interface merges two partitions into a single partition. The partitions must have the same aggregations and storage modes.

Applies To
clsPartition  

Syntax

partition.Merge(SourceName)

partition
The partition object into which to merge the source partition object.
SourceName
A string that contains the name of the source partition object.
Remarks

Before merging two partitions that specify data slices, you must first set the slice of the receiving partition to the slice that will apply after the merge is complete. Otherwise the partitions will not be successfully merged. The slice for the receiving partition must be the parent of the first level where the slice values for the two partitions differ.

For example, if you are merging a partition that contains data based on the slice [AllTime].[1998].[Quarter2] into a partition that contains [AllTime].[1998].[Quarter1], the target partition’s slice must be set to the parent of the two slices that differ, in this case [AllTime].[1998]. The target partition’s slice must be set to this value before merging the partitions. For more information, see Partitions and Merging Partitions.


Note This adjustment is done automatically when you merge partitions using the OLAP Manager user interface.


Example

' This example code merges the data slices of two partitions

' This subroutine does not merge the partitions

Sub MergeDataSlices(SourcePart As DSO.MDStore, _

    TargetPart As DSO.MDStore)

' Change the slice of the target partition

' Use the least common denominator of the two partitions

Dim spart_dim As DSO.Dimension

Dim spart_lev As DSO.Level

Dim tpart_dim As DSO.Dimension

Dim tpart_lev As DSO.Level

Dim nDim As Integer

Dim nLev As Integer

Dim nLev2 As Integer

' Search for the first level where the slice differs

' Then use the parent level just above it

For nDim = 1 To SourcePart.Dimensions.Count

  Set spart_dim = SourcePart.Dimensions(nDim)

  Set tpart_dim = targetPart.Dimensions(nDim)

  For nLev = 1 To spart_dim.Levels.Count

    Set spart_lev = spart_dim.Levels(nLev)

    Set tpart_lev = tpart_dim.Levels(nLev)

    If spart_lev.SliceValue <> tpart_lev.SliceValue Then

      ' Clear the slice values for all of the levels below

      ' in the target partition

      For nLev2 = nLev To spart_dim.Levels.Count

        Set tpart_lev = tpart_dim.Levels(nLev2)

        tpart_lev.SliceValue = ""

      Next

      Exit For

    End If

  Next

Next

targetPart.Update

Exit Sub

End Sub

 

See Also
About Decision Support Objects Using Decision Support Objects
Methods Cross-Reference  

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.