ComparisonValue: IValidationComparisonValue;
The ComparisonValue property returns comparison parameters.
Values for comparison can be absolute or percentage. To select value type, use the IValidationComparisonValue.Percentage property.
Executing the example requires that the repository contains a time series database with the TSDB_VALIDATION_PARAMETERS identifier containing a validation rule with the VALIDATION identifier.
Add links to the Dimensions, Metabase, Ms system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
RubrKey: Integer;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
Level: IValidationLevel;
ComparisonValue: IValidationComparisonValue;
Begin
Mb := MetabaseClass.Active;
// Get validation rule
RubrKey := Mb.GetObjectKeyById("TSDB_VALIDATION_PARAMETERS");
ValidObj := Mb.ItemByIdNamespace("VALIDATION", RubrKey).Edit;
ValidFilter := ValidObj As IValidationFilter;
// Set frequency level to which rule is applied
ValidFilter.Level := DimCalendarLevel.None;
// Specify validation type
ValidFilter.Kind := ValidationDetailsKind.Level;
// Get parameters of the Comparison with Number validation
Level := ValidFilter.Details As IValidationLevel;
// Set comparison parameters
ComparisonValue := Level.ComparisonValue;
ComparisonValue.ComparisonOperator := ValidationComparisonOperator.More;
ComparisonValue.Percentage := False;
ComparisonValue.Value1 := -0.3;
// Clear execution area and validation filter
Level.SelectionTargetData.Clear;
Level.SelectionFilter.Clear;
// Save the rule
ValidObj.Save;
End Sub UserProc;
After executing the example the Compare with Number validation rule is set up: series values which are greater than -0.3 are detected.
See also: