StartPosition: MsDimSelectionOffsetStartPosition;
The StartPosition property determines an element shift type.
Executing the example requires that the repository contains a calculation algorithm with the ALGORITHM identifier containing a calculation block. A data consumer and data sourcesshould be selected for calculation block, they contain at least two dimensions. A link in the simplified mode is created for the second data source dimension.
Add links to the Algo, Metabase, Ms system assemblies. Add links to the assemblies required for working with calculation algorithms.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObjectDescriptor;
Algo: ICalcObject;
List: ICalcObjectsList;
CalcAlgo: ICalcAlgorithm;
CalcBlock: ICalcObject;
Block: ICalcBlock;
IteratorModel: ICalcBlockIteratorModel;
IteratorStub: ICalcBlockIteratorStub;
IteratorStubs: ICalcBlockIteratorStubs;
IteratorStubDimension: ICalcBlockIteratorStubDimension;
IteratorStubDimensions: ICalcBlockIteratorStubDimensions;
Link: ICalcBlockIteratorStubDimensionLink;
Links: ICalcBlockIteratorStubDimensionLinks;
Begin
// Get calculation algorithm
MB := MetabaseClass.Active;
MObj := MB.ItemById("ALGORITHM");
Algo := CalcObjectFactory.CreateCalcObject(MObj, True);
CalcAlgo := Algo As ICalcAlgorithm;
// Get list of calculation algorithm objects
List := CalcAlgo.Items;
// Get calculation block
CalcBlock := List.Item(0);
Block := CalcBlock As ICalcBlock;
// Set up links between data source dimensions and data consumer dimensions
IteratorModel := Block.EditIteratorModel;
// Get data sources collection
IteratorStubs := IteratorModel.Stubs;
// Get the first data source
IteratorStub := IteratorStubs.Item(0);
// Get collection of data source dimensions
IteratorStubDimensions := IteratorStub.Dimensions;
// Get the second data source dimension, for which link is set up
IteratorStubDimension := IteratorStubDimensions.Item(1);
// Get advanced link settings
Links := IteratorStubDimension.Links;
Link := Links.Item(0);
// Set principle of work of link on block calculation
Link.Behaviour := MsLinkBehaviour.EmptyCoordAsEmptyValue;
// Set type of element offset - the first element
Link.StartPosition := MsDimSelectionOffsetStartPosition.First;
// Set offset of elements
Link.OffSet := 1;
// Save changes of link parameters
IteratorModel.Save;
// Save calculation block
Block.SaveObject;
End Sub UserProc;
After executing the example, the advanced link is set up between the second dimension of data source and data consumer dimension according to the specified parameters.
See also: