AggregationType: MsCollapseType;
AggregationType: Prognoz.Platform.Interop.Ms.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.
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;
CrossFrequency: IValidationCrossFrequency;
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.dclYear;
// Specify validation type
ValidFilter.Kind := ValidationDetailsKind.vdkCrossFrequency;
// Get the Compare Frequency Levels comparison validation parameters
CrossFrequency := ValidFilter.Details As IValidationCrossFrequency;
// Set comparison parameters
ComparisonValue := CrossFrequency.ComparisonValue;
ComparisonValue.ComparisonOperator := ValidationComparisonOperator.vcoLess;
ComparisonValue.Percentage := False;
ComparisonValue.Value1 := 0;
// Set compared level
CrossFrequency.FromLevel := DimCalendarLevel.dclQuarter;
// Set aggregation type
CrossFrequency.AggregationType := MsCollapseType.mctAverage;
// Clear execution area and validation filter
CrossFrequency.SelectionTargetData.Clear();
CrossFrequency.SelectionFilter.Clear();
// Save the rule
ValidObj.Save();
End Sub;
See also: