Params: IMsModelParams;
Params: Prognoz.Platform.Interop.Ms.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.
Executing the example requires a .NET form containing the LanerBoxNet component with the LanerBoxNet1 identifier and the UiErAnalayzerNet component with the UiErAnalyzerNet1 identifier. The uiErAnalyzerNet1 is a data source for lanerBoxNet1 and contains an 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.
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Dimensions;
…
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: ValidationExecuteSettings;
Analyzer: EaxAnalyzer;
ParamVals: IMsModelParamValues;
pDimInstance: IDimInstance;
DimSelect: IDimSelection;
ExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
Begin
mb := Self.Metabase;
FCObj := mb.ItemById["TSDB_70"].Bind();
FC := FCObj As IRubricator;
//Get dictionary, to which the COUNTRY attribute refers
Atts := FC.GetDictionary(RubricatorDictionary.rubdicFacts, RubricatorDictionaryOperation.rubdicopNone).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 filtering block";
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 := UiErAnalyzerNet1.ErAnalyzer.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;
Fore.NET example execution result matches with that of the Fore example.
See also: