LocalCopy: Boolean;
LocalCopy: Boolean;
The LocalCopy property determines whether data is copied with the help of an update when local copying of repository objects.
Available values:
True. On local copying of repository objects, data from source objects is copied by means of updating.
False. On local copying of repository objects, data from source objects is not copied by means of updating.
NOTE. In Foresight Analytics Platform the property is used for local copying of automatic cubes together with data. Particularly, it is used for copying modeling containers and its child objects, built on the basis of automatic cubes.
Executing the example requires that the repository contains a modeling container with the ModelSpace identifier. A folder with the COPY_OBJECT identifier is also created in the repository.
Add a link to the Metabase system assembly.
Sub UserProc;
Var
Mb: IMetabase;
Source, Parent: IMetabaseObjectDescriptor;
Update: IMetabaseUpdate;
RootNode: IMetabaseUpdateObjectNode;
Begin
Mb := MetabaseClass.Active;
Source := Mb.ItemById("ModelSpace");
Parent := Mb.ItemById("COPY_OBJECT");
Update := Mb.CreateUpdate;
//Local copy indicator
Update.LocalCopy := True;
//Update by identifiers
Update.BoundType := MetabaseObjectUpdateBoundType.ById;
//Adding of modeling container to an update root
//When executing the AddToUpdate method
//recursive adding of all child objects of a modeling catalog is performed
AddToUpdate(Source, Update.RootFolder);
RootNode := Update.RootFolder.Item(0) As IMetabaseUpdateObjectNode;
RootNode.Parent.ObjectId := Parent.Id;
//New name and identifier for catalog
RootNode.ObjectId := Source.Id + "_Copy";
RootNode.ObjectName := "Copy " + Source.Id;
Update.SaveToFileNF("c:\ModelSpace.pefx");
End Sub UserProc;
Sub AddToUpdate(Object: IMetabaseObjectDescriptor; Folder: IMetabaseUpdateFolderNode);
Var
Node: IMetabaseUpdateObjectNode;
NodeAsFolder: IMetabaseUpdateFolderNode;
Children: IMetabaseObjectDescriptors;
Child: IMetabaseObjectDescriptor;
Begin
Node := Folder.Add(MetabaseUpdateNodeType.Object) As IMetabaseUpdateObjectNode;
Node.Object := Object;
//Objects updating parameters
Node.UpdatePart := MetabaseObjectUpdatePart.DataMetadata;
Node.Constraint := MetabaseObjectUpdateConstraint.CreateOnly;
//Recursive adding of child objects
Children := Object.FetchChildren;
NodeAsFolder := Node As IMetabaseUpdateFolderNode;
For Each Child In Children Do
AddToUpdate(Child, NodeAsFolder);
End For;
End Sub AddToUpdate;
A new update file is created after example execution. A modeling container with all child objects is included in the update. This update is meant to be applied in the same repository, in which it was created. If an update is performed, a modeling container copy is created in the COPY_OBJECT folder. Variables of modeling are copied together with data.
This example is an entry point for the .NET assembly. The requirements and result of the Fore.NET example execution match with those in the Fore example.
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
Source, Parent: IMetabaseObjectDescriptor;
Update: IMetabaseUpdate;
RootNode: IMetabaseUpdateObjectNode;
Begin
Mb := Params.Metabase;
Source := Mb.ItemById["ModelSpace"];
Parent := Mb.ItemById["COPY_OBJECT"];
Update := Mb.CreateUpdate();
//Local copy indicator
Update.LocalCopy := True;
//Update by identifiers
Update.BoundType := MetabaseObjectUpdateBoundType.moubtById;
//Adding of modeling container to an update root
//When executing the AddToUpdate method
//recursive adding of all child objects of a modeling catalog is performed
AddToUpdate(Source, Update.RootFolder);
RootNode := Update.RootFolder.Item[0] As IMetabaseUpdateObjectNode;
RootNode.Parent.ObjectId := Parent.Id;
//New name and identifier for catalog
RootNode.ObjectId := Source.Id + "_Copy";
RootNode.ObjectName := "Copy " + Source.Id;
Update.SaveToFileNF("c:\ModelSpace.pefx");
End Sub;
Shared Sub AddToUpdate(Object: IMetabaseObjectDescriptor; Folder: IMetabaseUpdateFolderNode);
Var
Node: IMetabaseUpdateObjectNode;
NodeAsFolder: IMetabaseUpdateFolderNode;
Children: IMetabaseObjectDescriptors;
Child: IMetabaseObjectDescriptor;
Begin
Node := Folder.Add(MetabaseUpdateNodeType.untObject) As IMetabaseUpdateObjectNode;
Node.Object := Object;
//Objects updating parameters
Node.UpdatePart := MetabaseObjectUpdatePart.moupDataMetadata;
Node.Constraint := MetabaseObjectUpdateConstraint.moucCreateOnly;
//Recursive adding of child objects
Children := Object.FetchChildren();
NodeAsFolder := Node As IMetabaseUpdateFolderNode;
For Each Child In Children Do
AddToUpdate(Child, NodeAsFolder);
End For;
End Sub AddToUpdate;
See also: