MoveObject(Source: ICalcObject, Target: ICalcObject);
None;
Source. Calculation algorithm object to be moved.
Target. Calculation algorithm object, which place will be occupied by the specified object.
The MoveObject method reorders calculation algorithm objects.
Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier. The calculation algorithm should contains at least three objects.
Add a link to the Calculation Algorithm Core custom assembly contained in the Calculation Algorithms component, and links to the Algo, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Algo: ICalcObject;
List: ICalcObjectsList;
CalcAlgo: ICalcAlgorithm;
Source, Target: ICalcObject;
Begin
MB := MetabaseClass.Active;
// Get calculation algorithm
MObj := MB.ItemById("ALGORITHM");
Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
CalcAlgo := Algo As ICalcAlgorithm;
// Get list of calculation algorithm objects
List := CalcAlgo.Items;
// Move the first object to the place of the third one
Source := List.Item(0) As ICalcObject;
Target := List.Item(2) As ICalcObject;
CalcAlgo.MoveObject(Block1, Block3);
// Save changes in calculation algorithm
CalcAlgo.Save;
End Sub UserProc;
Not provisioned.
After executing the example the order of calculation object is changed in the calculation algorithm: the first object is moved to the place of the third one, the second object is moved to the place of the first one, and the third object is moved to the place of the second one.
See also: