ICalcBlock.CopyEntries

Syntax

CopyEntries(EntryKeys: Array; DestFolder: Integer);

Parameters

EntryKeys. Array of copied elements.

DestFolder. Key of the folder, to which elements are to be copied.

Description

The CopyEntries method copies the specified elements to the specified folder.

Comments

The EntryKeys array can contain keys of both specific formulas and folders with formulas.

Example

Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier. A calculation block is added in the calculation algorithm. Formulas are created in the calculation block.

Add links to the Algo, Metabase, Ms system assemblies. Add a link to the assembly required for working with calculation algorithm.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObjectDescriptor;
    Algo: ICalcObject;
    CalcList: ICalcObjectsList;
    CalcAlgo: ICalcAlgorithm;
    CalcBlock: ICalcBlock;
    Folder: IMsCalculationChainFolder;
    EntryKeys: Array Of Integer;
Begin
    MB := MetabaseClass.Active;
    // Get calculation algorithm
    MObj := MB.ItemById("ALGORITHM");
    Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
    CalcAlgo := Algo As ICalcAlgorithm;
    // Create a list of algorithm objects
    CalcList := CalcAlgo.Items.Clone;
    CalcBlock := CalcList.Item(0As ICalcBlock;
    // New folder, to which copy formula
    Folder := CalcBlock.AddFolder(CalcBlock.Folder);
    Folder.Name := "Copy";
    // First formula from existing in tree
    EntryKeys := New Integer[1];
    EntryKeys[0] := CalcBlock.Folder.Contents.Item(0).Key;
    CalcBlock.CopyEntries(EntryKeys, Folder.Key);
    // Save changes
    CalcBlock.SaveObject;
End Sub UserProc;

After executing the example a new folder is created in the tree of calculation block formulas. The first existing calculation block will be copied to this folder formula.

See also:

ICalcBlock