ComparisonType: ValidationRevisionComparisonType;
The ComparisonType property determines the type of value change between revisions.
To set parameters of value comparison, use the IValidationRevisionComparison.ComparisonValue property.
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(Null) As 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.
See also: