UnpivotMode: Boolean;
UnpivotMode: Boolean;
The UnpivotMode property determines whether data is imported in the crosstab mode.
Crosstab is a method of data presentation, at which information about various factors is located in headers of rows and columns, and actual data is located in row and column cells.
Available values:
True. Data is imported in the crosstab mode. To determine parameters of crosstab data identification and specify the data source, in which data is presented in the cross mode, use the IEtlPlainDataProvider.UnpivotProvider property.
False. Data is imported from the source specified in the IEtlPlainDataProvider.Provider property.
Executing the example requires that the repository contains an ETL task with the ETL_Task identifier. The file system contains a Microsoft Excel file named Data.xlsx, the file data is presented in the crosstab mode.
Sub UserProc;
Var
MB: IMetabase;
ETLTask: IEtlTask;
ETLProvider: IEtlPlainDataProvider;
UnpivotProvider: IDtUnpivotProvider;
ExcelProviderEx: IDtExcelProviderEx;
WxProvider: IWxRectangle;
WxETLProvider: IWxETLObject;
Begin
MB := MetabaseClass.Active;
ETLTask := MB.ItemById("ETL_Task").Edit As IEtlTask;
//Create a new data source
ETLProvider := ETLTask.Create(EtlObjectType.PlainDataExcelProviderEx) As IEtlPlainDataProvider;
ETLProvider := ETLProvider.Edit;
//Crosstab mode
ETLProvider.UnpivotMode := True;
//Specify data source, from which import will be used
ExcelProviderEx := ETLProvider.Provider As IDtExcelProviderEx;
ExcelProviderEx.File := "c:\data.xlsx";
ExcelProviderEx.Sheet := "Sheet1";
ExcelProviderEx.HasHeader := False;
ExcelProviderEx.Format := "XLSX";
//Set up crosstab parameters
UnpivotProvider := ETLProvider.UnpivotProvider;
UnpivotProvider.DataBottom := 5;
UnpivotProvider.DataWidth := 5;
UnpivotProvider.DataRight := 11;
UnpivotProvider.DataTop := 1;
UnpivotProvider.HeadTop := 0;
UnpivotProvider.HeadBottom := 0;
UnpivotProvider.HeadColumn := -1;
UnpivotProvider.LeftBegin := 0;
UnpivotProvider.LeftEnd := 1;
//Save data source
ETLProvider.FillDefault;
ETLProvider.Save;
//Create a visual object
WxProvider := EtlTask.Workspace.CreateRectangle;
WxETLProvider := New WxETLObject.Create;
WxETLProvider.ETLObject := EtlProvider;
WxProvider.Style.TextPosition := WxTextPosition.Bottom;
WxProvider.Style.PictureMarginTop := -10;
WxProvider.PinPosition := New GxPointF.Create(50, 50);
WxProvider.Extension := WxETLProvider As IWxShapeExtension;
//Save task
(ETLTask As IMetabaseObject).Save;
End Sub UserProc;
On executing the example a new data loader is created in the ETL task from Microsoft Excel file. Parameters required to import data in the crosstab mode are set up for the object.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Etl;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
ETLTask: IEtlTask;
ETLProvider: IEtlPlainDataProvider;
UnpivotProvider: IDtUnpivotProvider;
ExcelProviderEx: IDtExcelProviderEx;
WxProvider: IWxRectangle;
WxETLProvider: IWxETLObject = New WxEtlObjectClass();
ObjPoint: GxPointF = New GxPointFClass();
Begin
MB := Params.Metabase;
ETLTask := MB.ItemById["ETL_Task"].Edit() As IEtlTask;
//Create a new source
ETLProvider := ETLTask.Create(EtlObjectType.eotPlainDataExcelProviderEx) As IEtlPlainDataProvider;
ETLProvider := ETLProvider.Edit();
//Crosstab mode
ETLProvider.UnpivotMode := True;
//Specify a source, from which import will be executed
ExcelProviderEx := ETLProvider.Provider As IDtExcelProviderEx;
ExcelProviderEx.File := "c:\data.xlsx";
ExcelProviderEx.Sheet := "Sheet1";
ExcelProviderEx.HasHeader := False;
ExcelProviderEx.Format := "XLSX";
//Set up crosstab parameters
UnpivotProvider := ETLProvider.UnpivotProvider;
UnpivotProvider.DataBottom := 5;
UnpivotProvider.DataWidth := 5;
UnpivotProvider.DataRight := 11;
UnpivotProvider.DataTop := 1;
UnpivotProvider.HeadTop := 0;
UnpivotProvider.HeadBottom := 0;
UnpivotProvider.HeadColumn := -1;
UnpivotProvider.LeftBegin := 0;
UnpivotProvider.LeftEnd := 1;
//Save data source
ETLProvider.FillDefault();
ETLProvider.Save();
//Create a visual object
WxProvider := EtlTask.Workspace.CreateRectangle();
WxETLProvider.ETLObject := EtlProvider;
WxProvider.Style.TextPosition := WxTextPosition.wtpBottom;
WxProvider.Style.PictureMarginTop := -10;
ObjPoint.Create(50, 50);
WxProvider.PinPosition := ObjPoint;
WxProvider.Extension := WxETLProvider As IWxShapeExtension;
//Save task
(ETLTask As IMetabaseObject).Save();
End Sub;
See also: