AggregationType: MsCollapseType;
The AggregationType property determines data aggregation type.
To set compared frequency level, use the IValidationCrossFrequency.FromLevel 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;
CrossFrequency: IValidationCrossFrequency;
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.Year;
// Specify validation rule
ValidFilter.Kind := ValidationDetailsKind.CrossFrequency;
// Get parameters of the Compare Frequency Levels validation
CrossFrequency := ValidFilter.Details As IValidationCrossFrequency;
// Set comparison parameters
ComparisonValue := CrossFrequency.ComparisonValue;
ComparisonValue.ComparisonOperator := ValidationComparisonOperator.Less;
ComparisonValue.Percentage := False;
ComparisonValue.Value1 := 0;
// Set compared level
CrossFrequency.FromLevel := DimCalendarLevel.Quarter;
// Set aggregation type
CrossFrequency.AggregationType := MsCollapseType.Average;
// Clear execution area and validation filter
CrossFrequency.SelectionTargetData.Clear;
CrossFrequency.SelectionFilter.Clear;
// Save the rule
ValidObj.Save;
End Sub UserProc;
After executing the example the Comparison of Frequency Levels validation rule is set: difference between average value of annual and quarterly frequency should be less than zero.
See also: