SaveLaner(Laner: ILaner; SerieIndices: Array);
Laner. Working area of the time series database.
SerieIndices. Indexes of the saved series, represented as an array. If the given parameter value is Null, all the series are saved.
The SaveLaner method stores a model of the series workbook in the metamodel chain.
Executing the example requires a form, a button named Button1 on this form, the TabSheetBox component and the UiErAnalyzer component named UiErAnalyzer1 that is a data source for TabSheetBox. Workbook of the time series database must be loaded to UiErAnalyzer1. Modeling container of this database must include metamodel OBJ_METAMODEL.
Click the button to start executing of this example.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
ActiveMetabase: IMetabase;
ErAn: IEaxAnalyzer;
Cont: IMetabaseObjectDescriptor;
Ruby: IRubricator;
Laner: ILaner;
MModel: IMsMetaModel;
Serie, CalcSerie: ILanerCalculateSerie;
Ar: Array[1] Of Integer;
Series: ILanerSeries;
tr: IMsFormulaTransform;
OutVar, InpVar: IMsFormulaTransformVariable;
Slice: IMsFormulaTransformSlice;
Selector: IMsFormulaTransformSelector;
Formula: IMsFormula;
Determ: IMsDeterministicTransform;
TermInfo: IMsFormulaTermInfo;
Begin
ErAn := UiErAnalyzer1.ErAnalyzer;
Laner := ErAn.Laner;
Laner.BeginUpdate;
Series := Laner.Series;
CalcSerie := Series.Item(0) As ILanerCalculateSerie;
Serie := Series.AddCalculateSerieAsSource(CalcSerie.Source);
Serie.Name := Serie.SourceStub.Name + " + 10";
Serie.UseTransform := True;
Ar[0] := Series.Count - 1;
tr := Serie.Transform.Transform As IMsFormulaTransform;
OutVar := tr.Outputs.Item(0);
Slice := OutVar.Slices.Add(Null);
Selector := tr.CreateSelector;
Selector.Slice := Slice;
Formula := tr.Transform(Selector);
Formula.Kind := MsFormulaKind.Deterministic;
Determ := Formula.Method As IMsDeterministicTransform;
InpVar := tr.Inputs.Add(Serie.SourceStub);
Slice := InpVar.Slices.Add(Null);
TermInfo := tr.CreateTermInfo;
TermInfo.Slice := Slice;
Determ.Expression.AsString := TermInfo.TermInnerText + " + 10";
Laner.EndUpdate;
Ruby := Laner.RubricatorInstance.Rubricator;
Cont := Ruby.ModelSpace;
ActiveMetabase := MetabaseClass.Active;
MModel := ActiveMetabase.FetchItemById("OBJ_METAMODEL", Cont.Key).Edit As IMsMetaModel;
MModel.SaveLaner(Laner, Ar);
(MModel As IMetabaseObject).Save;
End Sub Button1OnClick;
After executing the example a new calculated series is added to the workbook. After that the calculation model of this series is added to the chain of metamodel OBJ_METAMODEL.
See also: