ITsParamProvider.Params

Syntax

Params: ITsModelParams;

Description

The Params property returns parameters collection.

Comments

To get the collection of parameter values, use the ITsModelParamValues interface.

Example

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.

See also:

ITsParamProvider