CopyTo(Dest: IMetabaseObjectDescriptor);
Dest. Calculation algorithm object, to which copying is executed.
The CopyTo method copies settings of the current object to the object sent in the input parameter.
Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier. Two calculation blocks are created in the algorithm.
Add links to the Algo, Metabase system assemblies. Add links to the assemblies required for working with calculation algorithms.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
CalcAlgo: ICalcAlgorithm;
Objects: ICalcObjectsList;
Algo, CalcAlgObj1, CalcAlgObj2: ICalcObject;
Begin
MB := MetabaseClass.Active;
// Get calculation algorithm
MObj := MB.ItemById("ALGORITHM");
Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
CalcAlgo := Algo As ICalcAlgorithm;
// Algorithm objects
Objects := CalcAlgo.Items;
CalcAlgObj1 := Objects.Item(0);
CalcAlgObj2 := Objects.Item(1);
// Copy settings from the first block to the second block
CalcAlgObj1.CopyTo(CalcAlgObj2.Descriptor);
// Save changes
Algo.SaveObject;
End Sub UserProc;
After executing the example, settings of the first calculation block will be copied to the second calculation block.
See also: