IValidationSelectionValues.ParameterAsSelection

Syntax

ParameterAsSelection: IMsModelParam;

Description

The ParameterAsSelection property determines parameters for sending selection to filter element.

Comments

To set the parameter value, use the IValidationExecuteSettings.ParamValues property

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_VALIDATION_PARAMETERS identifier. Time series database parameters:

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

The example is the method to add parameter to the validation filter. The parameter limits the filtered series set. Method input parameters:

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: IValidationSelectionFilter;
    Sel: IDimSelection;
    FilterVal: IValidationSelectionValues;
    ExecSett: IValidationExecuteSettings;
    Analyzer: IEaxAnalyzer;
    ParamVals: IMsModelParamValues;
    ExecRun: IValidationExecRun;
    DiagRep: IDiagnosticReport;
Begin
    mb := MetabaseClass.Active;
    // Get time series database
    FCObj := mb.ItemById("TSDB_VALIDATION_PARAMETERS").Bind;
    FC := FCObj As IRubricator;
    // Get dictionary, to which the CITY attribute refers
    Atts := FC.Facts.Attributes;
    LinkedDict := Atts.FindById("CITY").ValuesObject;
    // Get validation rule
    ValidObj := Mb.ItemByIdNamespace("VALIDATION_TREND", FCObj.Key).Edit;
    ValidFilter := ValidObj As IValidationFilter;
    // Get validation rule parameters
    Params := ValidFilter.Params;
    Params.Clear;
    // Add parameter for elements filtering
    FilterPrarm := Params.Add;
    FilterPrarm.Id := "FILTER_CITY";
    FilterPrarm.Name := "City for filter";
    FilterPrarm.LinkedObject := LinkedDict;
    // Set validation filter based on the parameter
    Filter := (ValidFilter.Details As IValidationTrend).SelectionFilter;
    Filter.Clear;
    Sel := (LinkedDict.Open(NullAs IDimInstance).CreateSelection;
    FilterVal := Filter.Add(Sel);
    If IsGroup Then
        FilterVal.ParameterAsGroup := FilterPrarm;
    Else
        FilterVal.ParameterAsSelection := FilterPrarm;
    End If;
    // Save validation rule
    ValidObj.Save;
    // Set rule execution parameters
    ExecSett := ValidFilter.CreateExecuteSettings;
    Analyzer := UiErAnalyzer1.ErAnalyzer;
    ExecSett.Laner := Analyzer.Laner;
    // Set parameter values
    ParamVals := ExecSett.ParamValues;
    ParamVals.FindById("FILTER_CITY").Value := Value;
    // Execute validation rule
    ExecRun := ValidFilter.Execute(ExecSett);
    DiagRep := New DiagnosticReport.Create;
    DiagRep.Run := ExecRun;
    DiagRep.EaxAnalyzer := Analyzer;
End Sub AddFilterParam;

After executing the example the filter is set for the VALIDATION_TREND validation rule. The selection forming the filter is set by the COMPAR_CITY parameter. This parameter determines value of the CITY mandatory attribute. The rule is calculated for the workbook displayed in WorkbookDocumentViewerBox1.

See also:

IValidationSelectionValues