SaveModel: IMetabaseObjectDescriptor;
SaveModel: Prognoz.Platform.Interop.Metabase.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.
Executing the example requires a .NET form with the button1 button, the LanerBoxNet component with the lanerBoxNet1 identifier and the UiErAnalayzerNet component with the uiErAnalayzerNet1 identifier that is a data source for lanerBoxNet1. The uiErAnalyzerNet1 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.
This example is a handler of the OnClick event for the button1 button.
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Laner;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
ErAn: IEaxAnalyzer;
Laner: ILaner;
Serie: ILanerSerie;
CalculateSerie: ILanerCalculateSerie;
i: Integer;
Begin
ErAn := uiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
Laner := ErAn.Laner;
For i := 0 To Laner.Series.Count - 1 Do
Serie := Laner.Series.Item[i];
If Serie.Kind = LnSerieKind.lskCalculate Then
CalculateSerie := Serie As ILanerCalculateSerie;
CalculateSerie.SaveModel();
System.Diagnostics.Debug.WriteLine(CalculateSerie.Model.Name);
End If;
End For;
End Sub;
Result of Fore.NET example execution matches with that of the Fore example.
See also: