CreateTermTransformationMethod(MethodType: MsTermTransformationType): IMsFormulaTermTransformationMethod;
MethodType. Term trasformation method.
The CreateTermTransformationMethod method creates an object that determines parameters of the term transformation.
Executing the example requires a form, a button with the Button1 identifier on this form, the TabSheetBox component and the UiErAnalyzer component named UiErAnalyzer1 that is used as a data source for TabSheetBox. A working area of time series database must be loaded to the UiErAnalyzer1 component. This database must include a time series with the key 98491 containing quarterly data.
Click the button to start executing of this example.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Laner: ILaner;
Factor: IRubricatorFactor;
Series: ILanerSeries;
serie: ILanerSourceSerie;
Transform: IFormulaTransformModel;
calcSerie: ILanerCalculateSerie;
t: IMsFormulaTransform;
Selector: IMsFormulaTransformSelector;
Slice, SliceInp: IMsFormulaTransformSlice;
MDic: IMetaDictionary;
MetaAttr: IMetaAttribute;
MsMetaAttributeValue: IMsMetaAttributeValue;
Formula: IMsFormula;
det: IMsDeterministicTransform;
Rubricator: IRubricator;
info: IMsFormulaTermInfo;
term: IMsFormulaTerm;
TermMeth: IMsFormulaTermTransformationMethod;
Collapse: IMsCollapseTransformationMethod;
Begin
Laner := UiErAnalyzer1.ErAnalyzer.Laner;
Laner.BeginUpdate;
Series := Laner.Series;
Factor := Laner.RubricatorInstance.GetFactData(98491).Factor;
serie := Series.AddSourceSerie(Factor);
calcSerie := Series.AddCalculateSerie("Collapse");
Transform := calcSerie.Transform;
Transform.AddInputVariable(serie.Stub);
t := Transform.Transform As IMsFormulaTransform;
Selector := T.CreateSelector;
Slice := T.Outputs.Item(0).Slices.Add(Null);
Selector.Slice := Slice;
Formula := T.Transform(Selector);
Formula.Level := DimCalendarLevel.Year;
Formula.Kind := MsFormulaKind.Deterministic;
Det := Formula.Method As IMsDeterministicTransform;
SliceInp := t.Inputs.Item(0).Slices.Add(Null);
Rubricator := Laner.RubricatorInstance.Rubricator;
Mdic := Rubricator.Facts;
MetaAttr := MDic.Attributes.FindByKind(MetaAttributeKind.CalendarLevel);
MsMetaAttributeValue := SliceInp.MetaAttributeValueList.Add(MetaAttr);
MsMetaAttributeValue.Value := DimCalendarLevelSet.Quarter;
term := Det.Operands.Add(SliceInp);
Info := term.TermInfo;
TermMeth := Info.CreateTermTransformationMethod(MsTermTransformationType.Collapse);
Collapse := TermMeth As IMsCollapseTransformationMethod;
Collapse.CollapseType := MsCollapseType.Maximum;
Info.TermTransformationMethod := Collapse;
Term.TermInfo := Info;
Det.Expression.AsString := term.TermToInnerText;
Laner.EndUpdate;
End Sub Button1OnClick;
After executing the example a new series that displays the data of indicated factor is added. Based on it, the series, calculated by the Collapse method is created. Data is aggregated from quarterly to annual frequency. Aggregation method is Maximum.
See also: