Bindings: ICubeMetaExporterBindings;
The Bindings property determines a binding of time series database attributes to data consumer fields.
Executing the example requires a time series database with the OBJ_RUBRICATOR identifier. This database must include the COUNTRIES attribute. Also add links to the Cubes, Dal, Dimensions, Dt, Metabase system assemblies.
Sub UserProc;
Var
TextConsumer: IDtTextConsumer;
MB: IMetabase;
Exporter: ICubeMetaExporter;
Binding: ICubeMetaExporterBinding;
Filter: ICubeMetaExporterFilter;
FilterValues: Array;
Begin
// Data successor to export to the textual format
TextConsumer := New DtTextConsumer.Create;
TextConsumer.File := "C:\result_meta_exp.txt";
TextConsumer.FormatType := DtTextFormatType.Delimited;
TextConsumer.DelimitedColumnDelimiter := ";";
TextConsumer.DelimitedTextQualifier := """";
TextConsumer.Encoding := "WIN";
TextConsumer.WriteHeader := True;
// Export parameters
Exporter := New CubeMetaExporterClass.Create;
MB := MetabaseClass.Active;
Exporter.Rubricator := MB.ItemById("OBJ_RUBRICATOR").Bind As IRubricator;
Exporter.Consumer := TextConsumer As IDtConsumer;
// Attribute binding COUNTRIES
Binding := Exporter.Bindings.Add;
Binding.FieldName := "CountryKey";
Binding.DataType := DbDataType.Integer;
Binding.BindingType := CubeMetaExporterBindingType.Attribute;
Binding.Attribute := "COUNTRIES";
Binding.KeyField := "KEY";
// Calendar binding
Binding := Exporter.Bindings.Add;
Binding.FieldName := "Year";
Binding.DataType := DbDataType.String;
Binding.BindingType := CubeMetaExporterBindingType.Calendar;
Binding.DateFormat := "$Year$";
Binding.ValueFieldName := "Value";
Binding.ValueDataType := DbDataType.Float;
// Filtration parameters
Exporter.ByColumns := False;
Exporter.PeriodStart := DateTime.Parse("01.01.2000");
Exporter.PeriodEnd := DateTime.Parse("01.01.2008");
Exporter.CalendarLevel := DimCalendarLevel.Year;
Filter := Exporter.Filters.Add;
Filter.Attribute := "COUNTRIES";
FilterValues := New Variant[2];
FilterValues[0] := 512;
FilterValues[1] := 914;
Filter.ValuesList := FilterValues;
// Export
Exporter.ClearBeforeExport := True;
Exporter.Export;
End Sub UserProc;
After executing the example factors are exported to the C:\result_meta_exp.txt file. Only data from 2000 to 2008 years is exported for those factors, which value of the COUNTRIES attribute is equal to 512 or 914. The file consumer is cleared before the export.
See also: