CreateCopy(Laner: ILaner): IMetabaseObjectDescriptor;
Laner. A workbook.
The CreateCopy method creates a copy of the specified workbook.
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.
Executing this example requires a form containing:
A button with the Button1 identifier.
The LanerBox component.
The UiErAnalyzer component with the UiErAnalyzer1 identifier that is used as data source for LanerBox. Workbook of the time series database must be loaded to UiErAnalyzer1.
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.
See also: