ParameterAsSelection: IMsModelParam;
The ParameterAsSelection property determines the parameter used to transfer the element selection used for validation calculation.
To set the parameter value, use the IValidationExecuteSettings.ParamValues property.
Executing the example requires a form, containing the LanerBox component with the LanerBox1 identifier and the UiErAnalayzer component with the UiErAnalyzer1 identifier. UiErAnalyzer1 is a data source for LanerBox1 and contains loaded workbook of the time series database with the TSDB_70 identifier. Database parameters:
The mandatory factor attribute with the COUNTRY identifier referring to the dictionary.
The validation filter with the VALIDATION_FILTER identifier of the Compare Trends type.
Add links to the Metabase, Ms, Cubes, Rds system assemblies.
The example is the function for adding a parameter to the validation filter. The parameter limits the filtered series set. Function input parameters:
IsGroup. It determines whether the parameter value is the group of elements. True - the parameter value is the group of elements. False - the parameter value is the elements selection.
Value. Parameter value.
Sub AddFilterParam(IsGroup: Boolean; Value: Variant);
Var
mb: IMetabase;
FCObj: IMetabaseObject;
FC: IRubricator;
Atts: IMetaAttributes;
LinkedDict: IMetabaseObjectDescriptor;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
Params: IMsModelParams;
FilterPrarm: IMsModelParam;
Filter: IMsMetaAttributeFilter;
FilterVal: IMsMetaAttributeValues;
ExecSett: IValidationExecuteSettings;
Analyzer: IEaxAnalyzer;
ParamVals: IMsModelParamValues;
ExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
Begin
mb := MetabaseClass.Active;
// Get time series database
FCObj := mb.ItemById("TSDB_70").Bind;
FC := FCObj As IRubricator;
//Get dictionary, to which the COUNTRY attribute refers
Atts := FC.GetDictionary(RubricatorDictionary.Facts).Attributes;
LinkedDict := Atts.FindById("COUNTRY").ValuesObject;
//Get validation filter
ValidObj := Mb.ItemByIdNamespace("VALIDATION_FILTER", FCObj.Key).Edit;
ValidFilter := ValidObj As IValidationFilter;
// Get validation filter parameters
Params := ValidFilter.Params;
Params.Clear;
// Add parameter for elements filtering
FilterPrarm := Params.Add;
FilterPrarm.Id := "FILTER_COUNTRY";
FilterPrarm.Name := "Country for filter";
FilterPrarm.LinkedObject := LinkedDict;
// Set validation filter
Filter := (ValidFilter.Details As IValidationTrend).Filter;
Filter.Clear;
FilterVal := Filter.Add(Atts.FindById("COUNTRY"));
If IsGroup Then
FilterVal.ParameterAsGroup := FilterPrarm;
Else
FilterVal.ParameterAsSelection := FilterPrarm;
End If;
// Save validation filter
ValidObj.Save;
// Set filter execution parameters
ExecSett := ValidFilter.CreateExecuteSettings;
Analyzer := UiErAnalyzer1.ErAnalyzer;
ExecSett.Laner := Analyzer.Laner;
// Set parameter values
ParamVals := ExecSett.ParamValues;
ParamVals.FindById("FILTER_COUNTRY").Value := Value;
// Execute validation filter
ExecRun := ValidFilter.Execute(ExecSett);
DiagRep := New DiagnosticReport.Create;
DiagRep.Run := ExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub AddFilterParam;
Example execution result: for the VALIDATION_FILTER validation filter series set, for which the filter is executed, is changed. Filtered series are set by the COMPAR_COUNTRY parameter determining value of the COUNTRY mandatory attribute. The filter is executed for the workbook displayed in LanerBox1.
See also: