DateFormat: String;
The DataFormat property determines format of data in a calendar dimension.
Executing the example requires a time series database with the OBJ_RUBRICATOR identifier. This database must include the COUNTRIES attribute.
Sub Main;
Var
TextConsumer: IDtTextConsumer;
MB: IMetabase;
Exporter: ICubeMetaExporter;
Binding: ICubeMetaExporterBinding;
Filter: ICubeMetaExporterFilter;
FilterValues: Array;
Begin
// Data consumer for exporting 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;
Binding := Exporter.Bindings.Add;
Binding.FieldName := "CountryKey";
Binding.DataType := DbDataType.Integer;
Binding.BindingType := CubeMetaExporterBindingType.Attribute;
Binding.Attribute := "COUNTRIES";
Binding.KeyField := "KEY";
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;
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.Export;
End Sub Main;
After executing the example factors are exported to the C:\result_meta_exp.txt file. Data from 2000 to 2008 years is exported for indicators, which value of the COUNTRIES property is equal to 512 or 914.
See also: