IValidationCorrelation.SelectionComparatorData

Syntax

SelectionComparatorData: 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.

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.

See also:

IValidationCorrelation