Params: ITsModelParams;
Params: Prognoz.Platform.Interop.Transfor.ITsModelParams;
The Params property returns parameters collection.
To get the parameters' values collection, use the ITsModelParamValues interface.
Executing the example requires a form containing the LanerBox component and the UiErAnalayzer component with the UiErAnalayzer1 identifier, which is a data source for LanerBox. UiErAnalyzer1 must contain a workbook of the time series database that contains calculated series.
Add links to the Cubes, Dal, Metabase, Transform system assemblies.
Sub ParamProv;
Var
Eax: IEaxAnalyzer;
ParamsProv: ITsParamProvider;
Params: ITsModelParams;
tParam: ITsModelParam;
ParamVals: ITsModelParamValues;
pVal: ITsModelParamValue;
Laner: ILaner;
i: Integer;
Serie: ILanerSerie;
CalcSerie: ILanerCalculateSerie;
TransfPeriod: ILanerTransformPeriod;
Begin
Eax := UiErAnalyzer1.ErAnalyzer;
// Get object that is used to work with parameters
ParamsProv := Eax.ParamProvider As ITsParamProvider;
ParamsProv.Params.Clear;
Params := ParamsProv.Params;
// Create new parameters and set their values
tParam := Params.Add;
tParam.ParamType := TsParamType.Date;
tParam.DataType := DbDataType.DateTime;
tParam.Id := "IDENT_START";
tParam.Name := "Start of identification";
tParam := Params.Add;
tParam.ParamType := TsParamType.Date;
tParam.DataType := DbDataType.DateTime;
tParam.Id := "IDENT_END";
tParam.Name := "End of identification";
tParam := Params.Add;
tParam.ParamType := TsParamType.Date;
tParam.DataType := DbDataType.DateTime;
tParam.Id := "FORECAST_END";
tParam.Name := "End of forecast";
// Set parameter values
ParamVals := ParamsProv.ParamValues;
// Start of identification
pVal := ParamVals.FindById("IDENT_START");
pVal.Value := "01.01.2003";
// End of identification
pVal := ParamVals.FindById("IDENT_END");
pVal.Value := "01.01.2007";
// End of forecast
pVal := ParamVals.FindById("FORECAST_END");
pVal.Value := "01.01.2015";
// Use parameters in workbook
Laner := Eax.Laner;
Laner.BeginUpdate;
// Get calculated series
For i := 0 To Laner.Series.Count - 1 Do
Serie := Laner.Series.Item(i);
If Serie.Kind = LnSerieKind.Calculate Then
CalcSerie := Serie As ILanerCalculateSerie;
TransfPeriod := CalcSerie.TransformPeriod;
TransfPeriod.AutoPeriod := TransformModelAutoPeriodOptions.None;
TransfPeriod.PeriodSet := LnTransformPeriodSet.All;
// Set parameters for period of series calculation
TransfPeriod.StartDateParamId := "IDENT_START";
TransfPeriod.IdentificationEndDateParamId := "IDENT_END";
TransfPeriod.EndDateParamId := "FORECAST_END";
End If;
End For;
// Update parametric values in workbook
Laner.Refresh;
Laner.EndUpdate;
End Sub ParamProv;
After executing the example the workbook contains parameters that determine a period of calculation for calculated series. Parameters' values are set, calculated series are recalculated in accordance with parameters' values.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Laner;
Imports Prognoz.Platform.Interop.Transform;
…
Public Sub ParamProv();
Var
Eax: IEaxAnalyzer;
ParamsProv: ITsParamProvider;
Params: ITsModelParams;
tParam: ITsModelParam;
ParamVals: ITsModelParamValues;
pVal: ITsModelParamValue;
Laner: ILaner;
i: Integer;
Serie: ILanerSerie;
CalcSerie: ILanerCalculateSerie;
TransfPeriod: ILanerTransformPeriod;
Begin
Eax := uiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
// Get object that is used to work with parameters
ParamsProv := Eax.ParamProvider As ITsParamProvider;
ParamsProv.Params.Clear();
Params := ParamsProv.Params;
// Create new parameters and set their values
tParam := Params.Add();
tParam.ParamType := TsParamType.tsptDate;
tParam.DataType := DbDataType.ddtDateTime;
tParam.Id := "IDENT_START";
tParam.Name := "Start of identification";
tParam := Params.Add();
tParam.ParamType := TsParamType.tsptDate;
tParam.DataType := DbDataType.ddtDateTime;
tParam.Id := "IDENT_END";
tParam.Name := "End of identification";
tParam := Params.Add();
tParam.ParamType := TsParamType.tsptDate;
tParam.DataType := DbDataType.ddtDateTime;
tParam.Id := "FORECAST_END";
tParam.Name := "End of forecast";
// Set parameter values
ParamVals := ParamsProv.ParamValues;
// Start of identification
pVal := ParamVals.FindById("IDENT_START");
pVal.Value := "01.01.2003";
// End of identification
pVal := ParamVals.FindById("IDENT_END");
pVal.Value := "01.01.2007";
// End of forecast
pVal := ParamVals.FindById("FORECAST_END");
pVal.Value := "01.01.2015";
// Use parameters in workbook
Laner := Eax.Laner;
Laner.BeginUpdate();
// Get calculated series
For i := 0 To Laner.Series.Count - 1 Do
Serie := Laner.Series.Item[i];
If Serie.Kind = LnSerieKind.lskCalculate Then
CalcSerie := Serie As ILanerCalculateSerie;
TransfPeriod := CalcSerie.TransformPeriod;
TransfPeriod.AutoPeriod := TransformModelAutoPeriodOptions.tmapoNone;
TransfPeriod.PeriodSet := LnTransformPeriodSet.ltpsAll;
// Set parameters for period of series calculation
TransfPeriod.StartDateParamId := "IDENT_START";
TransfPeriod.IdentificationEndDateParamId := "IDENT_END";
TransfPeriod.EndDateParamId := "FORECAST_END";
End If;
End For;
// Update parametric values in workbook
Laner.Refresh();
Laner.EndUpdate();
End Sub ParamProv;
See also: