IValidationExecuteSettings.DataMatrix

Syntax

DataMatrix: IMatrix;

Description

The DataMatrix property determines data matrix, by which validation is calculated.

Comments

If matrix is not set, validation is calculated by time series database data, to which the matrix belongs.

Example

Executing the example requires that the repository contains a time series database with the TSDB identifier that contains a validation rule with the NAMBCOMP_VALIDATION identifier.

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

Sub UserProc;
Var
    mb: IMetabase;
    TSDBObj: IMetabaseObjectDescriptor;
    Dest: ICubeInstanceDestination;
    DestExec: ICubeInstanceDestinationExecutor;
    DataMatrix: IMatrix;
    Ite: IMatrixIterator;
    ValidFilter: IValidationFilter;
    ExecSett: IValidationExecuteSettings;
    ExecRun: IValidationExecRun;
    i: Integer;
Begin
    Mb := MetabaseClass.Active;
    // Get time series database
    TSDBObj := Mb.ItemById("TSDB");
    // Get display option for time series database 
    Dest := (TSDBObj.Open(NullAs ICubeInstance).Destinations.DefaultDestination;
    DestExec := dest.CreateExecutor;
    DestExec.PrepareExecute(Null);
    DestExec.PerformExecute;
    // Get data
    DataMatrix := DestExec.Matrix;
    // Change data
    Ite := DataMatrix.CreateIterator;
    Ite.Move(IteratorDirection.First);
    While Ite.Valid Do
        If Ite.Value < 10 Then
            Ite.Value := Ite.Value + 10;
        End If;
        Ite.Move(IteratorDirection.Next);
    End While;
    // Get validation rule
    ValidFilter := Mb.ItemByIdNamespace("NAMBCOMP_VALIDATION", TSDBObj.Key).Bind As IValidationFilter;
    // Create parameters of validation rule execution
    ExecSett := ValidFilter.CreateExecuteSettings;
    // Set data, based on which validation is calculated
    ExecSett.DataMatrix := DataMatrix;
    // Calculate rule
    ExecRun := ValidFilter.Execute(ExecSett);
    // Display number of exceptions in the console window
    Ite := ExecRun.Matrix.CreateIterator;
    Ite.Move(IteratorDirection.First);
    While Ite.Valid Do
        i := i + 1;
        Ite.Move(IteratorDirection.Next);
    End While;
    Debug.WriteLine("Number of validation exceptions: " + i.ToString);
End Sub UserProc;

After executing the example the validation rule is calculated based on changed data of time series database. The number of validation exceptions is displayed in the console window.

See also:

IValidationExecuteSettings