IValidationRevisionComparison.ComparisonType

Fore Syntax

ComparisonType: ValidationRevisionComparisonType;

Fore.NET Syntax

ComparisonType: Prognoz.Platform.Interop.Ms.ValidationRevisionComparisonType;

Description

The ComparisonType property determines the type of value change between revisions.

Comments

To set parameters of value comparison, use the IValidationRevisionComparison.ComparisonValue property.

Fore Example

Executing the example requires that the repository contains the TSDB_VALIDATION_PARAMETERS time series database containing a validation rule with the VALIDATION identifier.

Add links to the Cubes, Dimensions, Metabase, Ms, Rds system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    RubrObj: IMetabaseObjectDescriptor;
    Rub: IRubricator;
    RubInst: IRubricatorInstance;
    ValidObj: IMetabaseObject;
    ValidFilter: IValidationFilter;
    DateSettings: IValidationDateSettings;
    RevisionComparison: IValidationRevisionComparison;
    ComparisonValue: IValidationComparisonValue;
    MetaData: IMetaDictionaryData;
    MetaMemb: IMetaDataMembers;
Begin
    Mb := MetabaseClass.Active;
    
// Get time series database
    RubrObj := Mb.ItemById("TSDB_VALIDATION_PARAMETERS");
    Rub := RubrObj.Bind 
As IRubricator;
    
// Get validation rule
    ValidObj := Mb.ItemByIdNamespace("VALIDATION", RubrObj.Key).Edit;
    ValidFilter := ValidObj 
As IValidationFilter;
    
// Specify that validation is executed by all levels of calendar frequency
    ValidFilter.Level := DimCalendarLevel.None;
    
// Specify validation rule
    ValidFilter.Kind := ValidationDetailsKind.RevisionComparison;
    
// Get parameters of the Compare Data Versions validation
    RevisionComparison := ValidFilter.Details As IValidationRevisionComparison;
    
// Set comparison parameters
    ComparisonValue := RevisionComparison.ComparisonValue;
    ComparisonValue.ComparisonOperator := ValidationComparisonOperator.Between;
    ComparisonValue.Percentage := 
False;
    ComparisonValue.Value1 := 
1;
    ComparisonValue.Value2 := 
10;
    
// Set value change type between revisions
    RevisionComparison.ComparisonType := ValidationRevisionComparisonType.Change;
    
// Set key of compared revision
    RubInst := RubrObj.Open(NullAs IRubricatorInstance;
    MetaData := RubInst.Revisions.GetData(
1);
    MetaMemb := MetaData.Record.Members;
    RevisionComparison.Revision := MetaMemb.FindById(
"KEY").Value;
    
// Clear execution area and validation filter
    RevisionComparison.SelectionTargetData.Clear;
    RevisionComparison.SelectionFilter.Clear;
    
// Save changes
    ValidObj.Save;
End Sub UserProc;

After executing the example the Compare with Data Version validation rule is set up: values from one to ten changed between the first and current revision are detected.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    RubrObj: IMetabaseObjectDescriptor;
    Rub: IRubricator;
    RubInst: IRubricatorInstance;
    ValidObj: IMetabaseObject;
    ValidFilter: IValidationFilter;
    DateSettings: IValidationDateSettings;
    RevisionComparison: IValidationRevisionComparison;
    ComparisonValue: IValidationComparisonValue;
    MetaData: IMetaDictionaryData;
    MetaMemb: IMetaDataMembers;
    i: integer;
Begin
    Mb := Params.Metabase;
    // Get time series database
    RubrObj := Mb.ItemById["TSDB_VALIDATION_PARAMETERS"];
    Rub := RubrObj.Bind() As IRubricator;
    // Get validation rule
    ValidObj := Mb.ItemByIdNamespace["VALIDATION", RubrObj.Key].Edit();
    ValidFilter := ValidObj As IValidationFilter;
    // Specify that validation is executed by all levels of calendar frequency
    ValidFilter.Level := DimCalendarLevel.dclNone;
    // Specify validation type
    ValidFilter.Kind := ValidationDetailsKind.vdkRevisionComparison;
    // Get the Compare Data Versions validation parameters
    RevisionComparison := ValidFilter.Details As IValidationRevisionComparison;
    // Set comparison parameters
    ComparisonValue := RevisionComparison.ComparisonValue;
    ComparisonValue.ComparisonOperator := ValidationComparisonOperator.vcoBetween;
    ComparisonValue.Percentage := False;
    ComparisonValue.Value1 := 1;
    ComparisonValue.Value2 := 10;
    // Set value change type between revisions
    RevisionComparison.ComparisonType := ValidationRevisionComparisonType.vrctChange;
    // Set key of compared revision
    RubInst := RubrObj.Open(NullAs IRubricatorInstance;
    MetaData := RubInst.Revisions.GetData(1False);
    MetaMemb := MetaData.Record.Members;
    i := MetaMemb.FindById("KEY").Value As integer;
    RevisionComparison.Revision := i As uinteger;
    // Clear execution area and validation filter
    RevisionComparison.SelectionTargetData.Clear();
    RevisionComparison.SelectionFilter.Clear();
    // Save changes
    ValidObj.Save();
End Sub;

See also:

IValidationRevisionComparison