Selection: IDimSelection;
The Selection property determines the element selection.
Executing the example requires a time series database with the OBJ_RUBRICATOR identifier. COUNTRY is the custom attribute of time series database that refers to the dictionary.
Sub Main;
Var
ActiveMetabase: IMetabase;
Ruby: IRubricator;
Transform: IMsFormulaTransform;
TransformVar: IMsFormulaTransformVariable;
Coord: IMsFormulaTransformCoord;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Det: IMsDeterministicTransform;
Term: IMsFormulaTerm;
TermInfo: IMsFormulaTermInfo;
MetaAttr: IMetaAttribute;
MetaVals: IMsMetaAttributeValues;
Dict: IMetabaseObject;
DI: IDimInstance;
Sel: IDimSelection;
Begin
ActiveMetabase := MetabaseClass.Active;
Ruby := ActiveMetabase.ItemById("OBJ_RUBRICATOR").Bind As IRubricator;
Transform := New MsFormulaTransform.Create(ActiveMetabase);
Transform.Rubricator := Ruby;
TransformVar := Transform.Outputs.Add(Null);
Coord := Transform.CreateCoord(TransformVar);
Slice := TransformVar.Slices.Add(Null);
Selector := Transform.CreateSelector;
Selector.Slice := Slice;
Formula := Transform.Transform(Selector);
Formula.Kind := MsFormulaKind.Deterministic;
Det := Formula.Method As IMsDeterministicTransform;
MetaAttr := Ruby.Facts.Attributes.FindById("COUNTRY");
MetaVals := Transform.MetaAttributeFilter.Add(MetaAttr);
Dict := MetaAttr.ValuesObject.Bind;
DI := Dict.Open(Null) As IDimInstance;
Sel := DI.CreateSelection;
Sel.SelectElement(0, False);
MetaVals.Selection := Sel;
TransformVar := Transform.Inputs.Add(Null);
Slice := TransformVar.Slices.Add(Null);
Term := Det.Operands.Add(Slice);
TermInfo := Term.TermInfo;
TermInfo.Lag := "-1";
Term.TermInfo := TermInfo;
Det.Expression.AsString := Term.TermToInnerText;
End Sub Main;
Executing this example creates an object that contains calculation parameters for series of the time series database.
See also: