Details: IValidationDetails;
The Details property returns the specific settings of the validation rule.
Depending on the value of the IValidationFilter.Kind property, this property cannot be cast to one of the following interfaces:
Executing the example requires a form containing the UiErAnalyzer1 component with the UiErAnalyzer1 identifier and the LanerBox component with the LanerBox1 identifier, receiving data from UiErAnalyzer1. UiErAnalyzer1 must contain a workbook of time series database with the TSDB_71 identifier. This database should contain a validation rule with the OBJ_VALID_FILTER identifier.
Add links to the Ms, Metabase, Cubes, Dimensions system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
RubrKey: Integer;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
DateSettings: IValidationDateSettings;
FilterSett: IValidationFilterSettings;
Level: IValidationLevel;
ComparisonValue: IValidationComparisonValue;
ValidExecSett: IValidationExecuteSettings;
Analyzer: IEaxAnalyzer;
ValidExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
Begin
Mb := MetabaseClass.Active;
// Get validation rule
RubrKey := Mb.GetObjectKeyById("TSDB_71");
ValidObj := Mb.ItemByIdNamespace("OBJ_VALID_FILTER", RubrKey).Edit;
ValidFilter := ValidObj As IValidationFilter;
// Set start and end dates of rule calculation
DateSettings := ValidFilter.StartDateSettings;
DateSettings.DateOptions := ValidationDateOptions.DependsFromData;
DateSettings := ValidFilter.EndDateSettings;
DateSettings.DateOptions := ValidationDateOptions.DependsFromData;
// Set calendar level for rule calculation
ValidFilter.Level := DimCalendarLevel.Year;
// Set threshold value for rule exceptions
ValidFilter.ExceptionsLimit := 500000;
// Set rule calculation options
FilterSett := ValidFilter.Settings;
// Set rule type
ValidFilter.Kind := ValidationDetailsKind.Level;
Level := ValidFilter.Details As IValidationLevel;
// Set rule conditions
ComparisonValue := Level.ComparisonValue;
ComparisonValue.ComparisonOperator := ValidationComparisonOperator.More;
ComparisonValue.Percentage := False;
ComparisonValue.Value1 := 50;
// Save changes in the rule
ValidObj.Save;
// Execute the rule on loaded workbook
ValidExecSett := New ValidationExecuteSettings.Create;
Analyzer := UiErAnalyzer1.ErAnalyzer;
ValidExecSett.Laner := Analyzer.Laner;
ValidExecRun := ValidFilter.Execute(ValidExecSett);
DiagRep := New DiagnosticReport.Create;
DiagRep.Run := ValidExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub UserProc;
After executing the example the Compare with Number validation rule is set up: annual values which are greater than 50 are detected. The rule is executed for the loaded workbook, for example:
See also: