CreateAndSetAttachmentsStorage(Database: IDatabase);
Database. Database where table for MDM dictionary will be created.
The CreateAndSetAttachmentsStorage method creates and sets dictionary to store attachments.
The method creates the MDM dictionary with predefined structure. Dictionary structure is described in the Cube Facts Binding subsection. Created dictionary is selected as storage location for attachments, its description will be available in the AttachmentsStorage property.
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 data source, which contains the ATTACHMENT integer field.
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);
//Create dictionary to store attachments
Dest.CreateAndSetAttachmentsStorage(DataSet.Dataset.Database);
//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;
On executing the example, an MDM dictionary to store attachments will be created and set for the 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: