IStandardCubeDestination.AttachmentsStorage

Syntax

AttachmentsStorage: IMetabaseObjectDescriptor;

AttachmentsStorage: Prognoz.Platform.Interop.Cubes.IMetabaseObjectDescriptor;

Description

The AttachmentsStorage property determines the attachments storage location.

Comments

Table MDM dictionary with predefined structure is set as property value. Dictionary structure is described in the Cube Facts Binding subsection. The dictionary can also be created and set as attachments storage using the CreateAndSetAttachmentsStorage method.

Example

Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier. The cube is set up for work with the source in which structure there is the ATTACHMENT integer field. The repository should also contain a table MDM dictionary with the D_ATTACHMENTS identifier, which structure allows for storing cube attachments.

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

Sub UserProc;
Var
    Mb: IMetabase;
    Cube: IStandardCube;
    Dest: IStandardCubeDestination;
    DataSet: IStandardCubeDataset;
    FactDimInst: IDimInstance;
    KeyAttribute: IDimAttributeInstance;
    Binding: IStandardCubeFactBinding;
Begin
    Mb := MetabaseClass.Active;
    Cube := Mb.ItemById(
"STD_CUBE").Edit As IStandardCube;
    Dest := Cube.Destinations.Item(
0);
    DataSet := Dest.Datasets.Item(
0);
    
//Dictionary to store attachments
    Dest.AttachmentsStorage := Mb.ItemById("D_ATTACHMENTS");
    
//Set up facts binding
    FactDimInst := Dest.FactDimension.OpenDimension;
    KeyAttribute := FactDimInst.Attributes.FindById(
"KEY");
    Binding := Dest.FactBindings(DataSet).BindingWithRole(KeyAttribute.Value(
0), CubeFactBindingRole.Attachment);
    Binding.Formula.AsString := (DataSet.Dataset 
As IMetabaseObject).Id + ".ATTACHMENT";
    
//Save cube
    (Cube As IMetabaseObject).Save;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    Cube: IStandardCube;
    Dest: IStandardCubeDestination;
    DataSet: IStandardCubeDataset;
    FactDimInst: IDimInstance;
    KeyAttribute: IDimAttributeInstance;
    Binding: IStandardCubeFactBinding;
Begin
    Mb := Params.Metabase;
    Cube := Mb.ItemById[
"STD_CUBE"].Edit() As IStandardCube;
    Dest := Cube.Destinations.Item[
0];
    DataSet := Dest.Datasets.Item[
0];
    
//Dictionary to store attachments
    Dest.AttachmentsStorage := Mb.ItemById["D_ATTACHMENTS"];
    
//Set up facts binding
    FactDimInst := Dest.FactDimension.OpenDimension;
    KeyAttribute := FactDimInst.Attributes.FindById(
"KEY");
    Binding := Dest.FactBindings[DataSet].BindingWithRole[KeyAttribute.Value[
0], CubeFactBindingRole.cfbrAttachment];
    Binding.Formula.AsString := (DataSet.Dataset 
As IMetabaseObject).Id + ".ATTACHMENT";
    
//Save cube
    (Cube As IMetabaseObject).Save();
End Sub;

After executing the example, existing table MDM dictionary will be set as attachments storage location for cube. For the first fact the binding with the source filed by which elements keys in dictionary of attachments will be stored will be set up.

See also:

IStandardCubeDestination