FillGapsUserMethod: IForeMethod;
The FillGapsUserMethod property determines the custom missing data treatment method.
To use a custom method, the IMsCrossDimensionAggregationOptions.UseFillGaps property must be set to True.
The series, introduced by the ITimeSeries interface is passed by first parameter of custom method. The other parameters are optional, their values are determined via the IMsCrossDimensionAggregationOptions.FillGapsUserMethodParams property. This method must return the ITimeSeries value cast to the Variant type.
To execute the example, the repository must contain a time series database with the OBJ_RUBRICATOR identifier, modeling container of which contains an extended aggregation model with the MODEL_AGGR identifier. Also, the repository must include the area of global parameters with the SHARED_P identifier, that contains the following method with key 1:
Public Function FillGaps(Input: ITimeSeries; SpecValue: Double): Variant;
Var
i: Integer;
Begin
For i := Input.StartIndex To Input.EndIndex Do
If Double.IsNan(Input.Item(i)) Then
Input.Item(i) := SpecValue;
End If;
End For;
Return Input;
End Function FillGaps;
Before the example execution, add the references to Metabase, Cubes, Ms, Fore system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Rubr: IRubricator;
MsDescr: IMetabaseObjectDescriptor;
Model: IMsModel;
ModelFormula: IMsFormula;
CrossDimAggr: IMsCrossDimensionAggregationTransform;
AggrOptions: IMsCrossDimensionAggregationOptions;
Shp: ISharedParams;
ShMethod: IForeMethod;
MetodParams: IMsUserMethodParams;
Begin
Mb := MetabaseClass.Active;
Rubr := Mb.ItemById("OBJ_RUBRICATOR").Bind As IRubricator;
MsDescr := Rubr.ModelSpace;
Model := Mb.ItemByIdNamespace("MODEL_AGGR", MsDescr.Key).Edit As IMsModel;
ModelFormula := Model.Transform.FormulaItem(0);
CrossDimAggr := ModelFormula.Method As IMsCrossDimensionAggregationTransform;
AggrOptions := CrossDimAggr.Options;
Shp := mb.ItemById("SHARED_P").Edit As ISharedParams;
ShMethod := Shp.Methods.FindByKey(1);
AggrOptions.FillGapsUserMethod := ShMethod;
MetodParams := AggrOptions.FillGapsUserMethodParams;
MetodParams.Item(1).Value := 10;
AggrOptions.UseFillGaps := True;
(Model As IMetabaseObject).Save;
End Sub UserProc;
After executing the example, model of extended aggregation calculation uses the custom missing data treatment.
See also: