ComparisonValue: IValidationComparisonValue;
ComparisonValue: Prognoz.Platform.Interop.Ms.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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
RubrKey: uinteger;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
Level: IValidationLevel;
ComparisonValue: IValidationComparisonValue;
Begin
Mb := Params.Metabase;
// 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.dclNone;
// Specify validation type
ValidFilter.Kind := ValidationDetailsKind.vdkLevel;
// Get parameters of the Comparison with Number validation
Level := ValidFilter.Details As IValidationLevel;
// Set comparison parameters
ComparisonValue := Level.ComparisonValue;
ComparisonValue.ComparisonOperator := ValidationComparisonOperator.vcoMore;
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;
See also: