IDynamicInstance.MergeWith

Fore Syntax

MergeWith(Other: IDynamicInstance): Boolean;

Fore.NET Syntax

MergeWith(Other: Prognoz.Platform.Interop.Dimensions.DynamicInstance): boolean;

Parameters

Other. Dictionary with which main dictionary should be merged.

Description

The MergeWith method merges dictionaries.

Fore Example

Executing the example requires a form containing the DimensionTree component with the DimensionTree1 identifier, the UiDimension component with the UiDimension1 identifier and the Button component with the Button1 identifier. Determine the UiDimension1 component as data source for the DimensionTree1 component. Data source for the UiDimension1 component must be MDM table dictionary with set dynamic loading of elements.

It is also required that repository contains additional MDM table dictionary with set dynamic loading of elements and with the MERGE_DIM identifier.

The example is a handler of the OnClick event for the Button1 component.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    MB: IMetabase;
    Dim: IDynamicInstance;
    DimForMerge: IDynamicInstance;
Begin
    MB := MetabaseClass.Active;
    Dim := UiDimension1.DimInstance As IDynamicInstance;
    // Open dictionary for merging
    DimForMerge := MB.ItemById("MERGE_DIM").Open(NullAs IDynamicInstance;
    If Dim.CanMergeWith(DimForMerge) Then
        Dim.MergeWith(DimForMerge);
    End If;
End Sub Button1OnClick;

On clicking the Button1 button data of the MERGE_DIM table dictionary will be copied in the dictionary located in the DimensionTree1 component.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.

Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    MB: IMetabase;
    Dim: IDynamicInstance;
    DimForMerge: DynamicInstance;
Begin
    MB := Self.Metabase;
    Dim := uiDimensionNet1.DimInstance As IDynamicInstance;
    // Open dictionary for merging
    DimForMerge := MB.ItemById["MERGE_DIM"].Open(NullAs DynamicInstance;
    If Dim.CanMergeWith(DimForMerge) Then
        Dim.MergeWith(DimForMerge);
    End If;
End Sub;

See also:

IDynamicInstance