IValidationSelectionValue.Element

Syntax

Element: Integer;

Description

The Element property determines selected element.

Comments

To get selection, use the IValidationSelectionValue.Selection 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.

Sub UserProc;
Var
    mb: IMetabase;
    FCObj: IMetabaseObject;
    FC: IRubricator;
    LinkedDict: IMetabaseObjectDescriptor;
    Dim: IDimInstance;
    DimSel: IDimSelection;
    ValidObj: IMetabaseObject;
    ValidFilter: IValidationFilter;
    Trend: IValidationTrend;
    Comparator: IValidationSelectionValueList;
    ComparVal: IValidationSelectionValue;
    ExecSett: IValidationExecuteSettings;
    Analyzer: IEaxAnalyzer;
    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"nbsp;attribute is referrednbsp;
    LinkedDict := FC.Facts.Attributes.FindById("CITY").ValuesObject;
    Dim := LinkedDict.Open(NullAs IDimInstance;
    DimSel := Dim.CreateSelection;
    //Get validation rule
    ValidObj := Mb.ItemByIdNamespace("VALIDATION_TREND", FCObj.Key).Edit;
    ValidFilter := ValidObj As IValidationFilter;
    // Get validation rule parameters
    Trend := ValidFilter.Details As IValidationTrend;
    // Set comparison expression
    Comparator := Trend.SelectionComparatorData;
    Comparator.Clear;
    ComparVal := Comparator.Add(DimSel);
    ComparVal.Element := 1;
    Debug.WriteLine(ComparVal.Selection.ToString);
    // Clear validation filter
    Trend.SelectionFilter.Clear;
    // Save validation rule
    ValidObj.Save;
    // Get rule execution parameters
    ExecSett := ValidFilter.CreateExecuteSettings;
    Analyzer := UiErAnalyzer1.ErAnalyzer;
    ExecSett.Laner := Analyzer.Laner;
    // Execute validation rule
    ExecRun := ValidFilter.Execute(ExecSett);
    DiagRep := New DiagnosticReport.Create;
    DiagRep.Run := ExecRun;
    DiagRep.EaxAnalyzer := Analyzer;
End Sub UserProc;

After executing the example the series, which trend is used for comparison, is changed for the VALIDATION_TREND validation rule. The compared series is set by the first element of the dictionary used as a base for the CITY mandatory attribute. Name of this element is displayed in the console window. The rule is executed for the workbook displayed in WorkbookDocumentViewerBox1.

See also:

IValidationSelectionValue