FillGapsUserMethod: IForeMethod;
The FillGapsUserMethod property determines a custom missing data treatment method.
The series introduced by the ITimeSeries interface is passed by the first parameter of custom method. The other parameters are optional, their values are determined via the IMsCrossDimensionAggregationOptions.FillGapsUserMethodParams property. The method must return the ITimeSeries value cast to the Variant type.
Executing the example requires that the repository contains a time series database with the OBJ_RUBRICATOR identifier, which modeling container contains an extended aggregation model with the MODEL_AGGR identifier. The repository must also include the area of global parameters with the SHARED_P identifier that contains the following method with the 1 key:
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 example execution, add links to the 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 the model of extended aggregation calculation uses the custom missing data treatment.
See also: