Validate: ICubeValidationAssertions;
The Validate method checks metadata of the cube at the editing stage.
The method results in the list of possible cube metadata violations.
Executing the example requires that the repository contains a calculated cube with the CALC_CUBE identifier.
Add links to the Cubes and Metabase system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
CalcCube: ICalculatedCube;
Cube: ICubeModel;
Validations: ICubeValidationAssertions;
Validation: ICubeValidationAssertion;
i, c: Integer;
Begin
Mb := MetabaseClass.Active;
CalcCube := Mb.ItemById("CALC_CUBE").Edit As ICalculatedCube;
//...
//Make changes in cube structure
//...
//Check cube
Cube := CalcCube As ICubeModel;
Validations := Cube.Validate;
If Validations.IsEmpty = True Then
Debug.WriteLine("Cube settings check did not return violations.");
Else
c := Validations.Count;
Debug.WriteLine("The number of found violations = " + c.ToString);
For i := 0 To c - 1 Do
Validation := Validations.Item(i);
Debug.WriteLine("Cause code: " + Validation.Code.ToString);
Debug.WriteLine("Importance level: " + Validation.Severity.ToString);
Debug.WriteLine(Validation.Text);
Debug.WriteLine("---------------------------");
End For;
End If;
If Validations.IsEmpty Or (Validations.MaxSeverity = CubeValidationAssertionSeverity.Info) Then
(CalcCube As IMetabaseObject).Save;
End If;
End Sub UserProc;
In the specified example, after the cube is opened for edit, some changes can be made in its structure. After this, the generated cube metadata is checked for correctness. If there are violations, information about them is displayed in the development environment console. If there are no violations or they are of information character, the made changes are saved in the cube.
See also: