IValidationRules.Item

Syntax

Item(Index: Integer): IValidationFilterModel;

Parameters

Index is the rule index in a collection.

Description

The Item property returns a rule from the collection based on its index.

Example

Executing the example requires a form with a button named Button1 on the form, the Memo component with the Memo1 identifier, the TabSheetBox component and the UiErAnalyzer component named UiErAnalyzer1 used as a data source for TabSheetBox. The workspace of time series database with the OBJ_FC identifier must be loaded to UiErAnalyzer1. This database should contain a validation filter with the VALIDATION_F identifier.

The example is executed on clicking the button.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Mb: IMetabase;

RurkKey: Integer;

ValidFilterObj: IMetabaseObject;

ValidFilter: IValidationFilter;

ValidExecSett: IValidationExecuteSettings;

Analyzer: IEaxAnalyzer;

Res: IValidationExecRun;

DiagnRep: IDiagnosticReport;

ValidationRules: IValidationRules;

i: Integer;

Begin

Mb := MetabaseClass.Active;

RurkKey := Mb.GetObjectKeyById("OBJ_FC");

ValidFilterObj := Mb.ItemByIdNamespace("VALIDATION_F", RurkKey).Bind;

ValidFilter := ValidFilterObj As IValidationFilter;

ValidExecSett := New ValidationExecuteSettings.Create;

Analyzer := UiErAnalyzer1.ErAnalyzer;

ValidExecSett.Laner := Analyzer.Laner;

Res := ValidFilter.Execute(ValidExecSett);

DiagnRep := New DiagnosticReport.Create;

DiagnRep.Run := Res;

DiagnRep.EaxAnalyzer := Analyzer;

DiagnRep.ShowExplainedExceptions := False;

ValidationRules := DiagnRep.Exceptions(1, 1);

If ValidationRules.Count > 0 Then

Memo1.Lines.Add("Explanation: " + DiagnRep.Explanation(1, 1));

For i := 0 To ValidationRules.Count - 1 Do

Memo1.Lines.Add("Rule ?" + i.ToString);

Memo1.Lines.Add("  Name = " + (ValidationRules.Item(i) As IMetabaseObject).Name);

End For;

Else Memo1.Lines.Add("No rules are performed for this cell");

End If;

End Sub Button1OnClick;

After executing the example the TabSheetBox component shows diagnostic report data. The Memo component shows explanation and data concerning the rules performed for the specified working area cell.

See also:

IValidationRules