ICubeMetaExporter.AutoPeriod

Syntax

AutoPeriod: IRubricatorAutoPeriodDate;

Description

The AutoPeriod property returns parameters of time series export period.

Comments

The start and end of the export period match the start and end of the data.

If export period is set relative to data start or end date, data borders are determined based on the value of the ICubeMetaExporter.ExportMode property:

Example

Executing the example requires that the repository contains a time series database with the TSDB identifier. This time series database must have annual and quarterly frequencies and a custom time series attribute with the INDICATOR identifier.

Add links to the Cubes, Dal, Dimensions, Dt, Metabase system assemblies.

Sub UserProc;
Var
    TextConsumer: IDtTextConsumer;
    MB: IMetabase;
    Exporter: ICubeMetaExporter;
    Binding: ICubeMetaExporterBinding;
    ExpPeriod: IRubricatorAutoPeriod;
    ExpPeriodDate: IRubricatorAutoPeriodDate;
Begin
    // Create a text data consumer
    TextConsumer := New DtTextConsumer.Create;
    TextConsumer.File := "C:\result.txt";
    TextConsumer.WriteHeader := True;
    // Create an object used for export
    Exporter := New CubeMetaExporterClass.Create;
    // Get current repository
    MB := MetabaseClass.Active;
    // Set time series database, which data will be exported
    Exporter.Rubricator := MB.ItemById("TSDB").Bind As IRubricator;
    // Specify data consumer
    Exporter.Consumer := TextConsumer As IDtConsumer;
    // Set export parameters for the INDICATOR attribute
    Binding := Exporter.Bindings.Add;
    Binding.FieldName := "INDICATOR_KEY";
    Binding.DataType := DbDataType.Integer;
    Binding.BindingType := CubeMetaExporterBindingType.Attribute;
    Binding.Attribute := "INDICATOR";
    Binding.KeyField := "KEY";
    // Set date export parameters
    Binding := Exporter.Bindings.Add;
    Binding.FieldName := "Date";
    Binding.DataType := DbDataType.String;
    Binding.BindingType := CubeMetaExporterBindingType.Calendar;
    // Set date export format
    Binding.DateFormatEx(DimCalendarLevel.Year) := "$Year$";
    Binding.DateFormatEx(DimCalendarLevel.Quarter) := "$Year$Q$Quarter$";
    // Set date export period
    ExpPeriod := Exporter.AutoPeriod;
    ExpPeriodDate := ExpPeriod.Start;
    ExpPeriodDate.AutoDateType := RubricatorAutoDateType.DateStart;
    ExpPeriodDate.Offset := 1;
    ExpPeriodDate := ExpPeriod.End_;
    ExpPeriodDate.AutoDateType := RubricatorAutoDateType.DateEnd;
    ExpPeriodDate.Offset := -1;
    // Set exported calendar levels
    Exporter.CalendarLevelSet := DimCalendarLevelSet.Year Or DimCalendarLevelSet.Quarter;
    // Execute export
    Exporter.Export;
End Sub UserProc;

After executing the example time series data by annual and quarterly frequencies are loaded to the C:\result.txt file. Export periods:

See also:

ICubeMetaExporter