Model: IMsModel;
The Model property returns a model, string view of which is generated.
Executing the example requires a form, a button named Button1 on it, the LanerBox component and the UiErAnalyzer component named UiErAnalyzer1 that is a data source for LanerBox. A workbook of the time series database must be loaded to UiErAnalyzer1. The first series of the workbook must be calculated.
Add links to the Metabase and Ms system assemblies.
The example is a handler of the OnClick event for a button.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Laner: ILaner;
Series: ILanerSeries;
CalcSerie: ILanerCalculateSerie;
ModelDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
StringGenerator: IMsModelStringGenerator;
Period: IMsModelPeriod;
s: String;
Begin
Laner := UiErAnalyzer1.ErAnalyzer.Laner;
Series := Laner.Series;
CalcSerie := Series.Item(0) As ILanerCalculateSerie;
ModelDescr := CalcSerie.SaveModel;
Model := ModelDescr.Edit As IMsModel;
StringGenerator := Model.CreateStringGenerator;
s := StringGenerator.Execute;
Period := StringGenerator.Model.Transform.Period;
s := s + " (" + Period.ForecastStartDate.ToString + ")";
(Model As IMetabaseObject).Name := s;
(Model As IMetabaseObject).Save;
End Sub Button1OnClick;
After executing the example the first series of workspace is saved as a model. The model name is generated and added by start date of forecasting period.
See also: