DataDomain: DbDataDomain;
The DataDomain property determines data type that is used to store multibyte information in attribute.
This property for attribute of the Long Text type must be set to DbDataDomain.Memo, and the IMetaAttribute.DataType property must be set to DbDataType.String.
Consider the following constraints on working with the Long Text attribute:
If Oracle or Teradata DBMS is used, it is not available to search for time series by this attribute value.
These attributes cannot be included into a unique index for time series database.
These attributes cannot be mandatory.
Sampling and saving of those attributes can be more slow than with simple text attributes.
Mnemonics cannot use attributes of table MDM dictionary with the Long Text type.
Executing the example requires that the repository contains a time series database with the TSDB_MEMO identifier containing the following time series attributes:
Observation attribute with the A_COMMENT identifier of the Long Text type.
Series attribute with the CITY identifier that is a link to a dictionary.
Add links to the Cubes, Dal, Dimensions, Dt, Metabase, Rds system assemblies.
Sub UserProc;
Var
TextConsumer: IDtTextConsumer;
MB: IMetabase;
CrInfo: IMetabaseObjectCreateInfo;
RubDescr: IMetabaseObjectDescriptor;
ObjDesc: IMetabaseObjectDescriptor;
Obj: IMetabaseObject;
ExportRequestDef: IExportRequestDefinition;
Params: IExportRequestParams;
Rubr: IRubricator;
Binding: ICubeMetaExporterBinding;
FactsDict: IMetaDictionary;
Attr: IMetaAttribute;
ExportRequestInst: IExportRequestInstance;
Begin
// Set up data consumer for export to text format
TextConsumer := New DtTextConsumer.Create;
TextConsumer.File := "C:\result.txt";
TextConsumer.FormatType := DtTextFormatType.Delimited;
TextConsumer.DelimitedColumnDelimiter := ";";
TextConsumer.DelimitedTextQualifier := """";
TextConsumer.Encoding := "WIN";
TextConsumer.WriteHeader := True;
// Get current repository and create an export object
MB := MetabaseClass.Active;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_EXPORTREQUEST;
RubDescr := MB.ItemById("TSDB_MEMO");
CrInfo.Parent := RubDescr;
CrInfo.Id := MB.GenerateId("OBJ_EXPORTREQUEST", RubDescr.Key);
CrInfo.Permanent := True;
ObjDesc := MB.CreateObject(CrInfo);
Obj := ObjDesc.Edit;
// Get export parameters
ExportRequestDef := Obj As IExportRequestDefinition;
Params := ExportRequestDef.Exporter;
// Specify data source
Rubr := RubDescr.Bind As IRubricator;
Params.Rubricator := Rubr;
// Specify data consumer
Params.Consumer := TextConsumer As IDtConsumer;
// Set binding for the CITY attribute
Binding := Params.Bindings.Add;
Binding.FieldName := "CityKey";
Binding.DataType := DbDataType.String;
Binding.BindingType := CubeMetaExporterBindingType.Attribute;
FactsDict := Rubr.Facts;
Attr := FactsDict.Attributes.FindById("CITY");
Binding.AttributeKey := Attr.Key;
Binding.KeyField := "KEY";
// Set calendar binding
Binding := Params.Bindings.Add;
Binding.FieldName := "Year";
Binding.DataType := DbDataType.String;
Binding.BindingType := CubeMetaExporterBindingType.Calendar;
Binding.DateFormat := "$Year$";
Binding.ValueFieldName := "Value";
Binding.ValueDataType := DbDataType.Float;
// Set binding for the A_COMMENT attribute of the Long Text type
Binding := Params.Bindings.Add;
Binding.FieldName := "Comment";
Binding.DataType := DbDataType.String;
Binding.DataDomain := DbDataDomain.Memo;
Binding.BindingType := CubeMetaExporterBindingType.ValueAttribute;
Binding.Attribute := "A_COMMENT";
// Set calendar frequency of exported data
Params.CalendarLevel := DimCalendarLevel.Year;
// Save changes
Obj.Save;
// Execute export
ExportRequestInst := ObjDesc.OpenWithParam(Null) As IExportRequestInstance;
ExportRequestInst.Export;
End Sub UserProc;
After executing the example data of the time series database is exported to the C:\result.txt file.
See also: