Details: IValidationDetails;
Details: Prognoz.Platform.Interop.Ms.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 parameters
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:
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.Ms;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Laner;
Imports Prognoz.Platform.Interop.Express;
…
Public Sub UserProc();
Var
Mb: IMetabase;
RubrKey: uinteger;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
DateSettings: IValidationDateSettings;
FilterSett: IValidationFilterSettings;
Level: IValidationLevel;
ComparisonValue: IValidationComparisonValue;
ValidExecSett: ValidationExecuteSettings;
Analyzer: EaxAnalyzer;
ValidExecRun: IValidationExecRun;
DiagRep: IDiagnosticReport;
Begin
mb := Self.Metabase;
// 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.vdoDependsFromData;
DateSettings := ValidFilter.EndDateSettings;
DateSettings.DateOptions := ValidationDateOptions.vdoDependsFromData;
// Set calendar level for rule calculation
ValidFilter.Level := DimCalendarLevel.dclYear;
// Set threshold value for rule exceptions
ValidFilter.ExceptionsLimit := 500000;
// Set rule calculation parameters
FilterSett := ValidFilter.Settings;
// Set rule type
ValidFilter.Kind := ValidationDetailsKind.vdkLevel;
Level := ValidFilter.Details As IValidationLevel;
// Set rule conditions
ComparisonValue := Level.ComparisonValue;
ComparisonValue.ComparisonOperator := ValidationComparisonOperator.vcoMore;
ComparisonValue.Percentage := False;
ComparisonValue.Value1 := 50;
// Save changes in rule
ValidObj.Save();
// Execute the rule on the loaded workbook
ValidExecSett := New ValidationExecuteSettings.Create();
Analyzer := uiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;
ValidExecSett.Laner := Analyzer.Laner;
ValidExecRun := ValidFilter.Execute(ValidExecSett);
DiagRep := New DiagnosticReport.Create();
DiagRep.Run := ValidExecRun;
DiagRep.EaxAnalyzer := Analyzer;
End Sub UserProc;
See also: