Params: IMsModelParams;
The Params property returns a set of parameters for a group of validation rules.
To manage parameters of child rules, use the IValidationFilters.ParamControl property.
Parameter values are specified in the object created by the IValidationGroup.CreateExecuteSettings method.
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.
Several validation rules containing only parameter with the FILTER_COUNTRY identifier. This parameter refers to the same dictionary as the COUNTRY attribute does.
Rules containing the FILTER_COUNTRY parameter are combined into a group of rules with the VALIDATION_GROUP identifier.
Add links to the Metabase, Ms, Cubes, Rds, Dimensions system assemblies.
Sub AddFilterGroupParam;
Var
mb: IMetabase;
FCObj: IMetabaseObject;
FC: IRubricator;
Atts: IMetaAttributes;
LinkedDict: IMetabaseObjectDescriptor;
ValidObj: IMetabaseObject;
ValidFilterGroup: IValidationGroup;
Params: IMsModelParams;
FilterParam: IMsModelParam;
Filters: IValidationFilters;
i: Integer;
ExecSett: IValidationExecuteSettings;
Analyzer: IEaxAnalyzer;
ParamVals: IMsModelParamValues;
pDimInstance: IDimInstance;
DimSelect: IDimSelection;
ExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
Begin
mb := MetabaseClass.Active;
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 the group of validation rules
ValidObj := Mb.ItemByIdNamespace("VALIDATION_GROUP", FCObj.Key).Edit;
ValidFilterGroup := ValidObj As IValidationGroup;
// Set threshold value for exceptions of the group of rules
ValidFilterGroup.ExceptionsLimit := 500000;
// Get the parameters of the group of validation rules
Params := ValidFilterGroup.Params;
Params.Clear;
// Create a parameter for the group of validation rules
FilterParam := Params.Add;
FilterParam.Id := "FILTER_COUNTRY";
FilterParam.Name := "Countries for the filteringnbsp;blockquot;;
FilterParam.LinkedObject := LinkedDict;
// Set control parameter
Filters := ValidFilterGroup.ValidationFilters;
For i := 0 To Filters.Count - 1 Do
Filters.ParamControl(i).Item(0).ControllingParam := FilterParam;
End For;
// Save the group of validation rules
ValidObj.Save;
// Set execution parameters of the group of rules
ExecSett := ValidFilterGroup.CreateExecuteSettings;
Analyzer := UiErAnalyzer1.ErAnalyzer;
ExecSett.Laner := Analyzer.Laner;
pDimInstance := LinkedDict.Open(Null) As IDimInstance;
// Create selection for element filtering
DimSelect := pDimInstance.CreateSelection;
DimSelect.DeselectAll;
DimSelect.SelectElement(0, False);
DimSelect.SelectElement(1, False);
DimSelect.SelectElement(2, False);
// Set parameter values
ParamVals := ExecSett.ParamValues;
ParamVals.FindById("FILTER_COUNTRY").Value := DimSelect.ToVariant;
ExecRun := ValidFilterGroup.Execute(ExecSett);
DiagRep := New DiagnosticReport.Create;
DiagRep.Run := ExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub AddFilterGroupParam;
Example execution result: for the VALIDATION_GROUP group of rules the parameter that controls parameters of child validations, is set. A group of rules is executed for the workbook displayed in LanerBox1.
See also: