IMetabaseObject.Assign

Syntax

Assign(Value: IMetabaseObject);

Assign(Value: Prognoz.Platform.Interop.Metabase.IMetabaseObject);

Parameters

Value. Repository object from that data are taken.

Description

The Assign method copies data from a source passed by the Value parameter.

Comments

This method cannot be used to copy objects that have embedded objects. Nested objects existence can be specified if the user get values of the IMetabaseObjectDescriptor.Children property. Nested objects impossible to copy are: facts of standard and virtual cubes, tasks and scenario dimension of a modeling container, express view cube.

While copying metamodel that contains internal models:

Example

Executing the example requires that the repository contains a module with the Module_1 identifier.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    CrInfo: IMetabaseObjectCreateInfo;
Begin
    MB := MetabaseClass.Active;
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_MODULE;
    CrInfo.Id := MB.GenerateId("New_Module");
    CrInfo.Name := "New unit";
    CrInfo.Parent := MB.Root;
    MObj := MB.CreateObject(CrInfo).Edit;
    MObj.Assign(MB.ItemById("Module_1").Bind);
    MObj.Save;
End Sub UserProc;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    CrInfo: IMetabaseObjectCreateInfo;
Begin
    MB := Params.Metabase;
    CrInfo := MB.CreateCreateInfo();
    CrInfo.ClassId := (MetabaseObjectClass.KE_CLASS_MODULE As integer);
    CrInfo.Id := MB.GenerateId("New_Module"1);
    CrInfo.Name := "New unit";
    CrInfo.Parent := MB.Root;
    MObj := MB.CreateObject(CrInfo).Edit();
    MObj.Assign(MB.ItemById["Module_1"].Bind());
    MObj.Save();    
End Sub;

A new module is created in the repository root after executing this example. Listing of a module is copied from the Module_1 module.

See also:

IMetabaseObject