IValidationGroup.ParamProvider

Fore Syntax

ParamProvider: IMsParamProvider;

Fore.NET Syntax

ParamProvider: Prognoz.Platform.Interop.Ms.IMsParamProvider;

Description

The ParamProvider property returns an object used to work with validation rule group parameters and their values.

Comments

By default, validation rule group does not contain parameters.

Fore Example

Executing the example requires a form containing the WorkbookDocumentViewerBox component with the WorkbookDocumentViewerBox1 identifier and the UiErAnalayzer component with the UiErAnalyzer1 identifier. UiErAnalyzer1 is a data source for WorkbookDocumentViewerBox1 and contains a loaded workbook of the time series database with the TSDB identifier. Time series database parameters:

Add links to the Cubes, Dimensions, Metabase, Ms, Rds, Stat system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    FCObj: IMetabaseObject;
    FC: IRubricator;
    Atts: IMetaAttributes;
    LinkedDict: IMetabaseObjectDescriptor;
    ValidObj: IMetabaseObject;
    ValidFilterGroup: IValidationGroup;
    ParamProvider: IMsParamProvider;
    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").Bind;
    FC := FCObj As IRubricator;
    //Get a dictionary to which the "CITY" attribute refers
    Atts := FC.GetDictionary(RubricatorDictionary.Facts).Attributes;
    LinkedDict := Atts.FindById("CITY").ValuesObject;
    //Get validation rule group
    ValidObj := Mb.ItemByIdNamespace("VALIDATION_GROUP", FCObj.Key).Edit;
    ValidFilterGroup := ValidObj As IValidationGroup;
    // Set threshold value for rule group exceptions
    ValidFilterGroup.ExceptionsLimit := 500000;
    // Get validation rule group parameters
    Analyzer := UiErAnalyzer1.ErAnalyzer;
    ValidFilterGroup.ParamProvider := Analyzer.ParamProvider As IMsParamProvider;
    ParamProvider := ValidFilterGroup.ParamProvider;
    Params := ParamProvider.Params;
    Params.Clear;
    // Create a parameter for validation rule group
    FilterParam := Params.Add;
    FilterParam.Id := "FILTER_CITY";
    FilterParam.Name := "Cities for filtering block";
    FilterParam.LinkedObject := LinkedDict;
    FilterParam.ParamType := TsParamType.Selection;
    // Save validation rule group
    ValidObj.Save;
    // Set execution parameters of the group of rules
    ExecSett := ValidFilterGroup.CreateExecuteSettings;
    ExecSett.Laner := Analyzer.Laner;
    pDimInstance := LinkedDict.Open(NullAs IDimInstance;
    // Create selection for element filtering
    DimSelect := pDimInstance.CreateSelection;
    DimSelect.DeselectAll;
    DimSelect.SelectElement(0False);
    DimSelect.SelectElement(1False);
    DimSelect.SelectElement(2False);
    // Set parameter values
    ParamVals := ExecSett.ParamValues;
    ParamVals.FindById("FILTER_CITY").Value := DimSelect.ToVariant;
    ExecRun := ValidFilterGroup.Execute(ExecSett);
    DiagRep := New DiagnosticReport.Create;
    DiagRep.Run := ExecRun;
    DiagRep.EaxAnalyzer := Analyzer;
End Sub UserProc;

After executing the example a parameter is set for the VALIDATION_GROUP rule group. A group of rules is executed for the workbook displayed in LanerBox1.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.Transform;

Sub UserProc();
Var
    mb: IMetabase;
    FCObj: IMetabaseObject;
    FC: IRubricator;
    Atts: IMetaAttributes;
    LinkedDict: IMetabaseObjectDescriptor;
    ValidObj: IMetabaseObject;
    ValidFilterGroup: IValidationGroup;
    ParamProvider: IMsParamProvider;
    Params: IMsModelParams;
    FilterParam: IMsModelParam;
    Filters: IValidationFilters;
    i: Integer;
    ExecSett: ValidationExecuteSettings;
    Analyzer: EaxAnalyzer;
    ParamVals: IMsModelParamValues;
    Val: IMsModelParamValue;
    pDimInstance: IDimInstance;
    DimSelect: IDimSelection;
    ExecRun: IValidationExecRun;
    DiagRep: IDiagnosticReport;
Begin
    mb := Self.Metabase;
    FCObj := mb.ItemById["TSDB"].Bind();
    FC := FCObj As IRubricator;
    //Get a dictionary to which the "CITY" attribute refers
    Atts := FC.GetDictionary(RubricatorDictionary.rubdicFacts, RubricatorDictionaryOperation.rubdicopNone).Attributes;
    LinkedDict := Atts.FindById("CITY").ValuesObject;
    //Get validation rule group
    ValidObj := Mb.ItemByIdNamespace["VALIDATION_GROUP", FCObj.Key].Edit();
    ValidFilterGroup := ValidObj As IValidationGroup;
    // Set threshold value for rule group exceptions
    ValidFilterGroup.ExceptionsLimit := 500000;
    // Get validation rule group parameters
    Analyzer := uiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
    ValidFilterGroup.ParamProvider := Analyzer.ParamProvider As IMsParamProvider;
    ParamProvider := ValidFilterGroup.ParamProvider;
    Params := ParamProvider.Params;
    Params.Clear();
    // Create a parameter for validation rule group
    FilterParam := Params.Add();
    FilterParam.Id := "FILTER_CITY";
    FilterParam.Name := "Cities for filtering block";
    FilterParam.LinkedObject := LinkedDict;
    FilterParam.ParamType := TsParamType.tsptSelection;
    //Save validation rule group
    ValidObj.Save();
    // Set execution parameters of the group of rules
    ExecSett := ValidFilterGroup.CreateExecuteSettings();
    ExecSett.Laner := Analyzer.Laner;
    pDimInstance := LinkedDict.Open(NullAs IDimInstance;
    // Create selection for element filtering
    DimSelect := pDimInstance.CreateSelection();
    DimSelect.DeselectAll();
    DimSelect.SelectElement(0False);
    DimSelect.SelectElement(1False);
    DimSelect.SelectElement(2False);
    // Set parameter values
    ParamVals := ExecSett.ParamValues;
    Val := ParamVals.FindById("FILTER_CITY");
    Val.Value := DimSelect;
    ExecRun := ValidFilterGroup.Execute(ExecSett);
    DiagRep := New DiagnosticReport.Create();
    DiagRep.Run := ExecRun;
    DiagRep.EaxAnalyzer := Analyzer;
End Sub UserProc;

See also:

IValidationGroup