DataMatrix: IMatrix;
DataMatrix: Prognoz.Platform.Interop.Matrix.IMatrix;
The DataMatrix property determines data matrix, by which validation is calculated.
If matrix is not set, validation is calculated by time series database data, to which the matrix belongs.
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(Null) As 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.
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.ForeSystem;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Ms;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
TSDBObj: IMetabaseObjectDescriptor;
Dest: ICubeInstanceDestination;
DestExec: ICubeInstanceDestinationExecutor;
DataMatrix: IMatrix;
Ite: IMatrixIterator;
ValidFilter: IValidationFilter;
ExecSett: ValidationExecuteSettings;
ExecRun: IValidationExecRun;
i: Integer;
Begin
Mb := Params.Metabase;
// Get time series database
TSDBObj := Mb.ItemById["TSDB"];
// Get display option for time series database
Dest := (TSDBObj.Open(Null) As ICubeInstance).Destinations.DefaultDestination;
DestExec := dest.CreateExecutor();
DestExec.PrepareExecute(Null);
DestExec.PerformExecute(False);
// Get data
DataMatrix := DestExec.Matrix;
// Change data
Ite := DataMatrix.CreateIterator();
Ite.Move(IteratorDirection.itdFirst);
While Ite.Valid Do
If (Ite.Value As double) < 10 Then
Ite.Value := (Ite.Value As double) + 10;
End If;
Ite.Move(IteratorDirection.itdNext);
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.itdFirst);
While Ite.Valid Do
i := i + 1;
Ite.Move(IteratorDirection.itdNext);
End While;
System.Diagnostics.Debug.WriteLine("Number of validation exceptions: " + i.ToString());
End Sub;
See also: