IValidationCorrelation.SelectionComparatorData

Fore Syntax

SelectionComparatorData: IValidationSelectionValueList;

Fore.NET Syntax

SelectionComparatorData: Prognoz.Platform.Interop.Ms.IValidationSelectionValueList;

Description

The SelectionComparatorData property returns a set of selections determining data used for correlation.

Comments

To set analyzed series, use the IValidationDetails.SelectionFilter property.

If SelectionComparatorData is not set, data for correlation is determined from the IValidationDetails.SelectionTargetData value.

Fore Example

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. The specified time series database should contain custom 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;
    ComparisonValue: IValidationComparisonValue;
    Correlation: IValidationCorrelation;
    SelectionFilter: IValidationSelectionFilter;
    FilterVals: IValidationSelectionValues;
    MetaAttr: IMetaAttribute;
    SelectionValList: IValidationSelectionValueList;
    SelectionVal: IValidationSelectionValue;
    DimInst: IDimInstance;
    DimSel: IDimSelection;
Begin
    Mb := MetabaseClass.Active;
    // Get time series database key
    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;
    // Set calendar frequency of checked data
    ValidFilter.Level := DimCalendarLevel.Year;
    // Set validation rule type
    ValidFilter.Kind := ValidationDetailsKind.Correlation;
    // Set up rule parameters
    Correlation := ValidFilter.Details As IValidationCorrelation;
    // Set condition parameters for correlation analysis
    ComparisonValue := Correlation.ComparisonValue;
    ComparisonValue.ComparisonOperator := ValidationComparisonOperator.More;
    ComparisonValue.Percentage := False;
    ComparisonValue.Value1 := 0.17;
    // Clear validation execution area
    Correlation.SelectionTargetData.Clear;
    // Set compared data
    SelectionFilter := Correlation.SelectionFilter;
    SelectionFilter.Clear;
    MetaAttr := Rub.Facts.Attributes.FindById("CITY");
    DimInst := MetaAttr.ValuesObject.Open(NullAs IDimInstance;
    DimSel := DimInst.CreateSelection;
    FilterVals := SelectionFilter.Add(DimSel);
    DimSel.SelectElement(1False);
    FilterVals.Selection := DimSel;
    // Set data used for correlation calculation
    SelectionValList := Correlation.SelectionComparatorData;
    SelectionValList.Clear;
    DimSel := DimInst.CreateSelection;
    SelectionVal := SelectionValList.Add(DimSel);
    DimSel.SelectElement(2False);
    SelectionVal.Value := DimSel.ToVariant;
    // Save the rule
    ValidObj.Save;
End Sub UserProc;

After executing the example the Correlation Dependency Analysis validation rule is set up.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    RubrObj: IMetabaseObjectDescriptor;
    Rub: IRubricator;
    ValidObj: IMetabaseObject;
    ValidFilter: IValidationFilter;
    ComparisonValue: IValidationComparisonValue;
    Correlation: IValidationCorrelation;
    SelectionFilter: IValidationSelectionFilter;
    FilterVals: IValidationSelectionValues;
    MetaAttr: IMetaAttribute;
    SelectionValList: IValidationSelectionValueList;
    SelectionVal: IValidationSelectionValue;
    DimInst: IDimInstance;
    DimSel: IDimSelection;
Begin
    Mb := Params.Metabase;
    // Get time series database key
    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;
    // Set calendar frequency of checked data
    ValidFilter.Level := DimCalendarLevel.dclYear;
    // Set validation rule type
    ValidFilter.Kind := ValidationDetailsKind.vdkCorrelation;
    // Set up rule parameters
    Correlation := ValidFilter.Details As IValidationCorrelation;
    // Set condition parameters for correlation analysis
    ComparisonValue := Correlation.ComparisonValue;
    ComparisonValue.ComparisonOperator := ValidationComparisonOperator.vcoMore;
    ComparisonValue.Percentage := False;
    ComparisonValue.Value1 := 0.17;
    // Clear validation execution area
    Correlation.SelectionTargetData.Clear();
    // Set compared data
    SelectionFilter := Correlation.SelectionFilter;
    SelectionFilter.Clear();
    MetaAttr := Rub.Facts.Attributes.FindById("CITY");
    DimInst := MetaAttr.ValuesObject.Open(NullAs IDimInstance;
    DimSel := DimInst.CreateSelection();
    FilterVals := SelectionFilter.Add(DimSel);
    DimSel.SelectElement(1False);
    FilterVals.Selection := DimSel;
    // Set data used for correlation calculation
    SelectionValList := Correlation.SelectionComparatorData;
    SelectionValList.Clear();
    DimSel := DimInst.CreateSelection();
    SelectionVal := SelectionValList.Add(DimSel);
    DimSel.SelectElement(2False);
    SelectionVal.Value := DimSel.ToVariant();
    // Save the rule
    ValidObj.Save();
End Sub;

See also:

IValidationCorrelation