Attributes: IValidationMetaAttributes;
The Attributes property returns time series database attributes, by which the data should be compared.
Attributes can only be of series level or observation level. It is not possible to compare the metadata by series attributes and observations simultaneously.
Executing the example requires that the repository contains the TSDB_VALIDATION_PARAMETERS time series database containing a validation rule with the VALIDATION identifier. The specified time series database should also contain a series attribute with the CITY identifier.
Add links to the Cubes, Dimensions, Metabase, Ms, Rds system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
RubrObj: IMetabaseObjectDescriptor;
Rub: IRubricator;
ValidObj: IMetabaseObject;
ValidFilter: IValidationFilter;
RevisionComparisonData: IValidationRevisionMetadataComparison;
FactAttrs: IMetaAttributes;
ValAttrs: IValidationMetaAttributes;
Attr: IMetaAttribute;
RubInst: IRubricatorInstance;
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 type
ValidFilter.Kind := ValidationDetailsKind.RevisionComparison;
// Get parameters of the Compare Metadata Versions validation
RevisionComparisonData := ValidFilter.Details As IValidationRevisionMetadataComparison;
// Set type of rule calculation and parameters of metadata comparison
RevisionComparisonData.CalculationType := MsCalculationType.Serie;
RevisionComparisonData.ComparisonType := ValidationRevisionMetadataComparisonType.Change;
// Set key of compared revision
RubInst := RubrObj.Open(Null) As IRubricatorInstance;
MetaData := RubInst.Revisions.GetData(1);
MetaMemb := MetaData.Record.Members;
RevisionComparisonData.Revision := MetaMemb.FindById("KEY").Value;
// Set attributes used for rule calculation
FactAttrs := Rub.Facts.Attributes;
Attr := FactAttrs.FindById("CITY");
ValAttrs := RevisionComparisonData.Attributes;
ValAttrs.Add(Attr);
// Clear execution area and validation filter
RevisionComparisonData.SelectionTargetData.Clear;
RevisionComparisonData.SelectionFilter.Clear;
// Save the rule
ValidObj.Save;
End Sub UserProc;
After executing the example the Compare with Metadata Version validation rule is set up: series with the CITY attribute value changed between the first and current revisions are detected.
See also: