IDynamicInstance.InitInstance

Fore Syntax

InitInstance(Src: IDimInstance; op: DynamicInstanceOperationsVisibility; Mark: Variant);

Fore.NET Syntax

InitInstance(Src: Prognoz.Platform.Interop.Dimensions.IDimInstance; op: Prognoz.Platform.Interop.Dimensions.DynamicInstanceOperationsVisibility; Mark: object);

Parameters

Src. Dictionary;

op. Parameter determines to which dictionaries executed operation is applied;

Mark. Set to which dictionary will belong.

Description

The InitInstance method initializes dictionary.

Fore Example

Executing the example requires that repository contains MDM table dictionary with the DYNDIM identifier.

Add links to the Dimensions and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Dim: IDynamicInstance;
    DimInst: IDimInstance;
Begin
    MB := MetabaseClass.Active;
    DimInst := MB.ItemById("DYNDIM").Open(NullAs IDimInstance;
    Dim := New DynamicInstance.Create;
    // Initialize dictionary
    Dim.InitInstance(DimInst, DynamicInstanceOperationsVisibility.Local, "Init");
    // Display dictionary name - data source
    Debug.WriteLine("Dictionary name: " + Dim.RootInstance.Name);
    // Display number of parent dictionary attributes
    Debug.WriteLine("Attributes in parent dictionary: " + 
        Dim.ParentInstance.AttributeCount.ToString);
End Sub UserProc;

After executing the example the console displays name of the dictionary - data source, number of attributes in parent dictionary.

Fore.NET Example

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

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

Public
 Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Dim: IDynamicInstance;
    DimInst: IDimInstance;
Begin
    MB := Params.Metabase;
    DimInst := MB.ItemById["DYNDIM"].Open(NullAs IDimInstance;
    Dim := New DynamicInstanceClass.Create();
    // Initialize dictionary
    Dim.InitInstance(DimInst, DynamicInstanceOperationsVisibility.diovLocal, "Init");
    // Display dictionary name - data source
    System.Diagnostics.Debug.WriteLine("Dictionary name: " + Dim.RootInstance.Name);
    // Display number of parent dictionary attributes
    System.Diagnostics.Debug.WriteLine("Attributes in parent dictionary: " + 
        Dim.ParentInstance.AttributeCount);
End Sub;

See also:

IDynamicInstance