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 Button1 button, the LanerBox component with the LanerBox1 identifier and the UiErAnalayzer component with the UiErAnalayzer1 identifier that is a data source for LanerBox1. The UiErAnalyzer1 must have loaded the workbook of a time series database. The workbook must contain only one calculated series, and values of all attributes must be set for it.
Add a link to the Metabase system assembly.
This example is a handler of the OnClick event for the Button1 button.
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, name of the model is shown in the console window.
See also: