ComparisonValue: IValidationComparisonValue;
ComparisonValue: Prognoz.Platform.Interop.Ms.IValidationComparisonValue;
The ComparisonValue property returns growth rate parameters.
Growth rate values can be absolute or percentage. To select value type, use the IValidationComparisonValue.Percentage 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;
GrowthRate: IValidationGrowthRate;
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.None;
// Specify validation type
ValidFilter.Kind := ValidationDetailsKind.GrowthRate;
// Get parameters of the Growth Rate Analysis rule
GrowthRate := ValidFilter.Details As IValidationGrowthRate;
// Set calculation parameters of growth rate
ComparisonValue := GrowthRate.ComparisonValue;
ComparisonValue.ComparisonOperator := ValidationComparisonOperator.Less;
ComparisonValue.Percentage := True;
ComparisonValue.Value1 := 10;
// Clear execution area and validation filter
GrowthRate.SelectionTargetData.Clear;
GrowthRate.SelectionFilter.Clear;
// Save the rule
ValidObj.Save;
End Sub UserProc;
After executing the example the Growth Rate Analysis validation is set up: series values with growth rate less than 10% are detected.
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;
GrowthRate: IValidationGrowthRate;
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.dclNone;
// Specify validation type
ValidFilter.Kind := ValidationDetailsKind.vdkGrowthRate;
// Get parameters of the Growth Rate Analysis rule
GrowthRate := ValidFilter.Details As IValidationGrowthRate;
// Set calculation parameters of growth rate
ComparisonValue := GrowthRate.ComparisonValue;
ComparisonValue.ComparisonOperator := ValidationComparisonOperator.vcoLess;
ComparisonValue.Percentage := True;
ComparisonValue.Value1 := 10;
// Clear execution area and validation filter
GrowthRate.SelectionTargetData.Clear();
GrowthRate.SelectionFilter.Clear();
// Save the rule
ValidObj.Save();
End Sub;
See also: