SaveModel: IMetabaseObjectDescriptor;
The SaveModel method saves a calculated series as a model.
If the MSSQL DBMS is used, and time series database uses a separate database to store data, correct execution of the method requires fulfilling one of the following conditions:
The database used to store data and the database of the used MDM repository must be located in one repository.
The database used to store data and the database of the used MDM repository must have application roles disabled.
Executing the example requires a form with the following components: the Button component named Button1, the LanerBox component named LanerBox1, and the UiErAnalyzer component named UiErAnalyzer1. UiErAnalyzer1 is a data source for LanerBox1. A workbook of a time series database should be loaded to UiErAnalyzer1. The workbook should contain only one calculated series, and values of all attributes should be set for it.
The example is a handler of the OnClick event for the Button1 component.
Add links to the Express, ExtCtrls, Forms, Laner, Metabase and Tab system assemblies.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
ErAn: IEaxAnalyzer;
Laner: ILaner;
Serie: ILanerSerie;
CalculateSerie: ILanerCalculateSerie;
i: Integer;
Begin
ErAn := UiErAnalyzer1.ErAnalyzer;
Laner := ErAn.Laner;
For i := 0 To Laner.Series.Count - 1 Do
Serie := Laner.Series.Item(i);
If Serie.Kind = LnSerieKind.Calculate Then
CalculateSerie := Serie As ILanerCalculateSerie;
CalculateSerie.SaveModel;
Debug.WriteLine(CalculateSerie.Model.Name);
End If;
End For;
End Sub Button1OnClick;
After executing the example the calculated series is saved as a model, the console window displays model name.
See also: