ParamValues: ITsModelParamValues;
The ParamValues property returns the collection of parameter values available in the custom calculation method.
Parameters are available if they are contained in the calculated model.
The example displays a custom calculation method.
Add links to the Dal, Ms, Transform system assemblies.
Function UserFunction(Input: ITimeSeries): Variant;
Var
pContext: ITsCalculationContext;
i, k: Integer;
pParVals: ITsModelParamValues;
pParVal: ITsModelParamValue;
Begin
// Get custom calculation method context
pContext := TsCalculation.Current;
pParVals := pContext.ParamValues;
// If numeric parameters are available in calculation,
// increase value of observations for parameter value
If (pParVals <> Null) And (pParVals.Count > 0) Then
For i := 0 To pParVals.Count - 1 Do
pParVal := pParVals.Item(i);
If (pParVal.DataType = DbDataType.Float) Or (pParVal.DataType = DbDataType.Integer) Then
For k := Input.StartIndex To Input.EndIndex Do
Input.Item(k) := Input.Item(k) + pParVal.Value;
End For;
End If;
End For;
// If there are no parameters, fill series with zeros
Else
For k := Input.StartIndex To Input.EndIndex Do
Input.Item(k) := 0;
End For;
End If;
// Return changed series
Return Input;
End Function UserFunction;
If there are numeric parameters available in calculation, the method increases the value of observations of input series for parameter value; if there are no parameters, the method fills the series with zeros.
See also: