IValidationFilter.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 parameters and their values.

Comments

By default, validation rule 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 time series database workbook 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;
    ValidFilter: IValidationFilter;
    ParamProvider: IMsParamProvider;
    Params: IMsModelParams;
    ExecSett: IValidationExecuteSettings;
    Analyzer: IEaxAnalyzer;
    ParamVals: IMsModelParamValues;
    DimSel: IDimSelection;
    ExecRun: IValidationExecRun;
    DiagRep: IDiagnosticReport;
    FilterPrarm: IMsModelParam;
    Filter: IValidationSelectionFilter;
    DimInstance: IDimInstance;
    FilterVal: IValidationSelectionValues;
Begin
    mb := MetabaseClass.Active;
    // Get time series database
    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
    ValidObj := Mb.ItemByIdNamespace("VALIDATION_COMPARPARAM", FCObj.Key).Edit;
    ValidFilter := ValidObj As IValidationFilter;
    // Get validation rule parameters
    Analyzer := UiErAnalyzer1.ErAnalyzer;
    ValidFilter.ParamProvider := Analyzer.ParamProvider As IMsParamProvider;
    ParamProvider := ValidFilter.ParamProvider;
    Params := ParamProvider.Params;
    Params.Clear;
    // Add filtering parameter
    FilterPrarm := Params.Add;
    FilterPrarm.Id := "COMPAR_CITY";
    FilterPrarm.Name := "City for filtering block";
    FilterPrarm.LinkedObject := LinkedDict;
    FilterPrarm.ParamType := TsParamType.Selection;
    // Save validation rule
    ValidObj.Save;
    // Set rule execution parameters
    ExecSett := ValidFilter.CreateExecuteSettings;
    ExecSett.Laner := Analyzer.Laner;
    // Set filter
    Filter := ExecSett.SelectionFilter;
    Filter.Clear;
    DimInstance := LinkedDict.Open(NullAs IDimInstance;
    DimSel := DimInstance.CreateSelection;
    FilterVal := Filter.Add(DimSel);
    FilterVal.OutputParameter := FilterPrarm;
    // Set parameter values
    ParamVals := ExecSett.ParamValues;
    DimSel.DeselectAll;
    DimSel.SelectElement(1False);
    ParamVals.FindById("COMPAR_CITY").Value := DimSel;
    // Execute validation rule
    ExecRun := ValidFilter.Execute(ExecSett);
    DiagRep := New DiagnosticReport.Create;
    DiagRep.Run := ExecRun;
    DiagRep.EaxAnalyzer := Analyzer;
End Sub UserProc;

Example execution parameter: filter is set for the VALIDATION_COMPARPARAM validation rule. Filtering is set by the COMPAR_CITY parameter determining value of the CITY mandatory attribute. The rule is executed for the workbook displayed in WorkbookDocumentViewerBox1.

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;
    ValidFilter: IValidationFilter;
    ParamProvider: IMsParamProvider;
    Params: IMsModelParams;
    FilterPrarm: IMsModelParam;
    ExecSett: ValidationExecuteSettings;
    Analyzer: EaxAnalyzer;
    ParamVals: IMsModelParamValues;
    DimSel: IDimSelection;
    ExecRun: IValidationExecRun;
    DiagRep: IDiagnosticReport;
    Filter: IValidationSelectionFilter;
    DimInstance: IDimInstance;
    FilterVal: IValidationSelectionValues;
Begin
    mb := Self.Metabase;
    // Get time series database
    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
    ValidObj := Mb.ItemByIdNamespace["VALIDATION_COMPARPARAM", FCObj.Key].Edit();
    ValidFilter := ValidObj As IValidationFilter;
    // Get validation rule parameters
    Analyzer := uiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
    ValidFilter.ParamProvider := Analyzer.ParamProvider As IMsParamProvider;
    ParamProvider := ValidFilter.ParamProvider;
    Params := ParamProvider.Params;
    Params.Clear();
    // Add filtering parameter
    FilterPrarm := Params.Add();
    FilterPrarm.Id := "COMPAR_CITY";
    FilterPrarm.Name := "City for filtering block";
    FilterPrarm.LinkedObject := LinkedDict;
    FilterPrarm.ParamType := TsParamType.tsptSelection;
    // Save validation rule
    ValidObj.Save();
    // Set rule execution parameters
    ExecSett := ValidFilter.CreateExecuteSettings();
    ExecSett.Laner := Analyzer.Laner;
    // Set filter
    Filter := ExecSett.SelectionFilter;
    Filter.Clear();
    DimInstance := LinkedDict.Open(NullAs IDimInstance;
    DimSel := DimInstance.CreateSelection();
    FilterVal := Filter.Add(DimSel);
    FilterVal.OutputParameter := FilterPrarm;
    // Set parameter values
    ParamVals := ExecSett.ParamValues;
    DimSel.DeselectAll();
    DimSel.SelectElement(1False);
    ParamVals.FindById("COMPAR_CITY").Value := DimSel;
    // Execute validation rule
    ExecRun := ValidFilter.Execute(ExecSett);
    DiagRep := New DiagnosticReport.Create();
    DiagRep.Run := ExecRun;
    DiagRep.EaxAnalyzer := Analyzer;
End Sub UserProc;

See also:

IValidationFilter