IDtTextProvider.DataFromClipboard

Syntax

DataFromClipboard: Boolean;

Description

The DataFromClipboard property determines whether to use clipboard as the data provider for import. True - clipboard is used as the data provider for import.

Example

Executing the example requires a time series database with the OBJ_RUBRICATOR identifier.

Sub Main;

Var

TextProvider: IDtTextProvider;

Provider: IDatasetDataProvider;

Mb: IMetabase;

RubDesc: IMetabaseObjectDescriptor;

CrInfo: IMetabaseObjectCreateInfo;

Obj: IMetabaseObject;

ObjDesc: IMetabaseObjectDescriptor;

ImportRequestDef: IImportRequestDefinition;

ImportRequestProviderParams: IImportRequestProviderParams;

Binding: ICubeMetaLoaderBinding;

Begin

// Data source for import from clipboard

TextProvider := New DtTextProvider.Create;

TextProvider.DataFromClipboard := True;

TextProvider.FormatType := DtTextFormatType.Delimited;

TextProvider.DelimitedColumnDelimiter := ";";

TextProvider.DelimitedTextQualifier := """";

TextProvider.Encoding := "WIN";

TextProvider.RangeHasHeader := True;

TextProvider.Open;

 

Mb := MetabaseClass.Active;

RubDesc := Mb.ItemById("OBJ_RUBRICATOR");

Provider := (TextProvider As IDatasetDataProvider);

 

// Import object

CrInfo := Mb.CreateCreateInfo;

CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_IMPORTREQUEST;

CrInfo.Id := "OBJ_IMPORTREQUEST_P";

CrInfo.Name := "Import object";

CrInfo.Permanent := True;

CrInfo.Parent := RubDesc.Bind;

ObjDesc := Mb.CreateObject(CrInfo);

Obj := ObjDesc.Edit;

 

// Set up source

ImportRequestDef := Obj As IImportRequestDefinition;

ImportRequestDef.SourceType := ImportRequestSourceType.Provider;

ImportRequestDef.DestinationRubricator := RubDesc.Bind As IRubricator;

 

// Import parameters

ImportRequestProviderParams := ImportRequestDef.ProviderParams;

ImportRequestProviderParams.Provider := Provider;

ImportRequestProviderParams.NewRevisionName := "Indicators import";

ImportRequestProviderParams.ImportObjectKey := Obj.Key;

ImportRequestProviderParams.LoadType := CubeMetaLoaderLoadType.CreateAndUpdate;

Binding := ImportRequestProviderParams.Bindings.Add;

Binding.BindingType := CubeMetaLoaderBindingType.Calendar;

Binding.CalendarOptions.Levels := DimCalendarLevelSet.Year;

Binding.ByColumns := False;

Binding.CalendarDateFormat := "$Year$";

Obj.Save;

End Sub Main;

The object of importing time series from the clipboard is created in the time series database after executing the example. In the object calendar parameters are set. During import as a field delimiter symbol ";" is used, as a text delimiter - double quotes symbol. Delimiters running in succession are skipped. Field names are imported from the second file row.

See also:

IDtTextProvider