LocalCopy: Boolean;
The LocalCopy property determines whether data is copied by means of update on local copying of repository objects.
Available values:
True. On local copying of repository objects, data from source objects is copied by means of update.
False. On local copying of repository objects, data from source objects is not copied by means of update.
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 and a folder with COPY_OBJECT identifier.
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;
//Indicates whether copy is local
Update.LocalCopy := True;
//Update by identifiers
Update.BoundType := MetabaseObjectUpdateBoundType.ById;
//Add a modeling container to an update root
//When executing the AddToUpdate method
//recursive adding of all child objects of a modeling catalog
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 update 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;
After executing the example a new update file is created. 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 executed, a modeling container copy is created in the COPY_OBJECT folder. Variables of modeling are copied together with data.
See also: