Show contents 

Cubes > Cubes Assembly Interfaces > ICubeMetaExporterBindings > ICubeMetaExporterBindings.Add

ICubeMetaExporterBindings.Add

Syntax

Add: ICubeMetaExporterBinding;

Description

The Add method adds a new formula to the collection.

Example

Executing the example requires a time series database with the OBJ_RUBRICATOR identifier. This database must include the COUNTRIES attribute. The file system must contain the C:\result_meta_exp.txt file with indicator values.

Sub UserProc;
Var
    TextConsumer: IDtTextConsumer;
    MB: IMetabase;
    Exporter: ICubeMetaExporter;
    Binding: ICubeMetaExporterBinding;
    Filter: ICubeMetaExporterFilter;
    FilterValues: Array;
Begin
    // Data consumer for export to text 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 options
    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.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 UserProc;

After executing the example the indicators are exported to the text file. Data is exported only for the indicators, which COUNTRIES attribute's value is equal to 512 or 914.

See also:

ICubeMetaExporterBindings