IValidationSelectionValueList.ScenarioKey

Syntax

ScenarioKey: Integer;

Description

The ScenarioKey property determines the scenario key, by which validation should be calculated.

Comments

By default, ScenarioKey is set to -1, that is, validation is calculated based on actual data (the Fact scenario).

The calculation on scenario data is available for validations working with data and not metadata.

Supported validation types

Example

Executing the example requires a form, containing the WorkbookDocumentViewerBox component with the WorkbookDocumentViewerBox1 identifier and the UiErAnalayzer component with the UiErAnalyzer1 identifier. UiErAnalyzer1 is a data source for WorkbookDocumentViewerBox1 and contains a time series database workbook with the TSDB_VALIDATION_PARAMETERS identifier. The specified time series database contains a validation rule with the VALIDATION_NUMBER identifier of the Compare with Number type. The modeling container in the time series database should contain several scenarios.

Add links to the Cubes, Metabase, Ms system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    RubrKey: Integer;
    ValidObj: IMetabaseObject;
    ValidFilter: IValidationFilter;
    Level: IValidationLevel;
    ComparisonValue: IValidationComparisonValue;
    ValidExecSett: IValidationExecuteSettings;
    ValidExecRun: IValidationExecRun;
    DiagRep: IDiagnosticReport;
    SelValList: IValidationSelectionValueList;
    Rub: IRubricator;
    ms: IMsModelSpace;
    ScenElement: IMsScenarioTreeElement;
    Analyzer: IEaxAnalyzer;
Begin
    Mb := MetabaseClass.Active;
    // Get time series database
    RubrKey := Mb.GetObjectKeyById("TSDB_VALIDATION_PARAMETERS");
    Rub := Mb.ItemById("TSDB_VALIDATION_PARAMETERS").Bind As IRubricator;
    // Get validation rule
    ValidObj := Mb.ItemByIdNamespace("VALIDATION_NUMBER", RubrKey).Edit;
    // Set rule conditions
    ValidFilter := ValidObj As IValidationFilter;
    Level := ValidFilter.Details As IValidationLevel;
    ComparisonValue := Level.ComparisonValue;
    ComparisonValue.ComparisonOperator := ValidationComparisonOperator.More;
    ComparisonValue.Percentage := False;
    ComparisonValue.Value1 := -0.3;
    // Set scenario used for validation calculation
    SelValList := Level.SelectionTargetData;
    ms := Rub.ModelSpace.Bind As IMsModelSpace;
    ScenElement := ms.ScenarioTree.Item(0As IMsScenarioTreeElement;
    SelValList.ScenarioKey := ScenElement.Scenario.InternalKey;
    // Save changes
    ValidObj.Save;
    // Validate
    ValidExecSett := New ValidationExecuteSettings.Create;
    Analyzer := UiErAnalyzer1.ErAnalyzer;
    ValidExecSett.Laner := Analyzer.Laner;
    ValidExecRun := ValidFilter.Execute(ValidExecSett);
    DiagRep := New DiagnosticReport.Create;
    DiagRep.Run := ValidExecRun;
    DiagRep.EaxAnalyzer := Analyzer;
End Sub UserProc;

After executing the example the Compare with Number validation rule is set up: series values which are greater than -0.3 are detected using the specified scenario.

See also:

IValidationSelectionValueList