ICubeAttachments.Attributes

Syntax

Attributes: ICubeAttachmentAttributes;

Description

The Attributes property returns collection of dictionary attributes where cube attachments are stored.

Comments

Dictionary to store attachments is specified in the IStandardCubeDestination.AttachmentsStorage property.

Example

Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier. Binding of facts to store attachments is set in cube, by some cube coordinates attachments are saved.

Add links to the Cubes, Dal, Dimensions, Matrix, and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CubeInst: ICubeInstance;
    Dest: ICubeInstanceDestination;
    Sels: IDimSelectionSet;
    Sel: IDimSelection;
    Exec: ICubeInstanceDestinationExecutor;
    Mat: IMatrix;
    MatEx: IMatrixEx;
    Ite: IMatrixIterator;
    ExecResult: ICubeExecuteResult;
    Manager: ICubeAttachmentManager;
    Ats: ICubeAttachments;
    Attrs: ICubeAttachmentAttributes;
    Attr: ICubeAttachmentAttribute;
    i, c: Integer;
Begin
    MB := MetabaseClass.Active;
    CubeInst := MB.ItemById(
"STD_CUBE").Open(NullAs ICubeInstance;
    Dest := CubeInst.Destinations.DefaultDestination;
    
//Cube selection
    Sels := Dest.CreateDimSelectionSet;
    
For Each Sel In Sels Do
        Sel.SelectAll;
    
End For;
    Exec := Dest.CreateExecutor;
    Exec.IncludeAttachments := 
True;
    Exec.PrepareExecute(Sels);
    Exec.PerformExecute;
    Mat := Exec.Matrix;
    
//Resulting cube matrix   
    MatEx := Mat As IMatrixEx;
    
If MatEx.AttachmentValueIndex < 0 Then
        Debug.WriteLine(
"AttachmentValueIndex <0. Aborted ");
        
Return;
    
End If;
    ExecResult := CubeClass.ExecuteResult(Mat);
    
//Manager to work with cube attachments
    Manager := ExecResult.CreateAttachmentManager;
    
//Matrix iterator
    Ite := Mat.CreateIterator;
    Ite.Move(IteratorDirection.First);
    
While Ite.Valid Do
        
//Attachments by the current coordinate
        Ats := Manager.ReadAttachments(Ite);
        
If Ats <> Null Then
            Attrs := Ats.Attributes;
            c := Attrs.Count;
            
For i := 0 To c - 1 Do
                Attr := Attrs.Item(i);
                Debug.WriteLine(Attr.Name +
                    
".Data type: " + Attr.DataType.ToString +
                    
".Empty values: " + Attr.Nullable.ToString +
                    
".Link to repository object: " + Attr.ObjectLinked.ToString);
            
End For;
            
Break;
        
End If;
        Ite.Move(IteratorDirection.Next);
    
End While;
End Sub UserProc;

On executing the example the resulting cube matrix will be calculated and manager to work with attachments will be obtained. Information by dictionary attributes where attachments are stored will be displayed to the development environment console.

See also:

ICubeAttachments