ILanerContext.CreateCopy

Fore Syntax

CreateCopy(Laner: ILaner): IMetabaseObjectDescriptor;

Fore.NET Syntax

CreateCopy(Laner: Prognoz.Platform.Interop.Laner.ILaner): Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor;

Parameters

Laner. A workbook.

Description

The CreateCopy method creates a copy of the specified workbook.

Comments

A workbook can be used only in one context. To register a workbook in several contexts, use its copies.

During copying of a workbook within one context all formulas that use series from other workbooks are saved. During copying of a workbook between different contexts the formulas that contain dependences on other workbooks are lost.

Fore Example

Executing this example requires a form containing:

There should also be the pContext variable that contains context.

Add a link to the Metabase system assembly. Example is a handler of the OnClick event for the button.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    pContext: ILanerContext;
    Laner: ILaner;
    LanerObject: IMetabaseObjectDescriptor;
Begin
    pContext.BeginLoad;
    Laner := UiErAnalyzer1.ErAnalyzer.Laner;
    If Not Laner.IsInContext Then
        pContext.Register(Laner);
    Else
        LanerObject := pContext.CreateCopy(Laner);
        pContext.Register((LanerObject As IEaxAnalyzer).Laner);
        pContext.EndLoad;
    End If;
End Sub Button1OnClick;

After executing the example, a workbook is registered in a context. If it is already in the context, then its copy is registered.

Fore.NET Example

Executing the example requires a .NET form containing:

Example is a handler of the Click event for the button.

Imports Prognoz.Platform.Interop.Laner;
Imports Prognoz.Platform.Interop.Express;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    pContext: ILanerContext;
    Laner: ILaner;
    LanerObject: IMetabaseObjectDescriptor;
Begin
    pContext.BeginLoad();
    Laner := uiErAnalyzerNet1.ErAnalyzer.ErAnalyzer.Laner;
    If Not Laner.IsInContext Then
        pContext.Register(Laner As LanerFactory);
    Else
        LanerObject := pContext.CreateCopy(Laner As LanerFactory);
        pContext.Register((LanerObject As IEaxAnalyzer).Laner);
        pContext.EndLoad();
    End If;
End Sub;

After executing the example, a workbook is registered in a context. If it is already in the context, then its copy is registered.

See also:

ILanerContext