ValueFilters: ICubeMetaExporterFilters;
The ValueFilters property determines filtering parameters for exported time series by observation attributes.
Filtering is not executed by default, and all time series are exported.
Executing the example requires a time series database with the TSDB identifier. This database must contain a time series attribute with the CITY identifier that refers to a dictionary.
Add links to the Cubes, Dal, Dt, Metabase, Orm system assemblies.
Sub UserProc;
Var
TextConsumer: IDtTextConsumer;
MB: IMetabase;
Exporter: ICubeMetaExporter;
Binding: ICubeMetaExporterBinding;
Filter: ICubeMetaExporterFilter;
FilterValues: Array;
Begin
// Create a data consumer for export to text file
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;
// Create an object for export
Exporter := New CubeMetaExporterClass.Create;
// Get current repository
MB := MetabaseClass.Active;
// Specify data source and data consumer
Exporter.Rubricator := MB.ItemById("TSDB").Bind As IRubricator;
Exporter.Consumer := TextConsumer As IDtConsumer;
// Add CITY series attribute binding
Binding := Exporter.Bindings.Add;
Binding.FieldName := "CityKey";
Binding.DataType := DbDataType.Integer;
Binding.BindingType := CubeMetaExporterBindingType.Attribute;
Binding.Attribute := "CITY";
Binding.KeyField := "KEY";
// Add CMT observation attribute binding
Binding := Exporter.Bindings.Add;
Binding.FieldName := "CMT";
Binding.DataType := DbDataType.String;
Binding.BindingType := CubeMetaExporterBindingType.ValueAttribute;
Binding.Attribute := "CMT";
// Add a 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;
// Set filtering parameters for exported series
// Add filtering by CMT observation attribute values
Filter := Exporter.ValueFilters.Add;
Filter.Attribute := "CMT";
// Specify that attribute values must not be empty
Filter.Operator_ := OrmComparisonOperator.IsNotNull;
// Execute export
Exporter.ClearBeforeExport := True;
Exporter.Export;
End Sub UserProc;
After executing the example only the series with values of the CMT attribute are exported to the C:\result_meta_exp.txt file.
See also: