IEtlPlainDataForceQueryForFile.ForceQuery

Syntax

ForceQuery: Boolean;

Description

The ForceQuery property determines whether a file for data provider on ETL task execution is requested.

Comments

Available values:

NOTE. When creating an ETL task via data import, the ForceQuery property of data providers is set to True.

Example

Executing the example requires:

Add links to the Andy, Drawing, Dt, Etl, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    EtlTask: IEtlTask;
    i, j, k: Integer;
    EtlProvider: IEtlPlainDataProvider;
    ETLConsumer: IEtlPlainDataConsumer;
    QueryForFile: IEtlPlainDataForceQueryForFile;
    dtProv: IDtExcelProviderEx;
    dtCons: IDtExcelConsumer;
    WxProvider, WxConsumer: IWxRectangle;
    WxETLProvider, WxETLConsumer: IWxETLObject;
    ProvPlainOutput: IEtlPlainOutput;
    ConsPlainInput: IEtlPlainInput;
    PlainLink: IEtlPlainLink;
    WLink: IWxLink;
    WxETLLink: IWxETLObject;
    FieldMapping: IEtlPlainLinkFieldMapping;
    ETLSrcF, ETLDestF: IEtlPlainField;
Begin
    // Get repository
    MB := MetabaseClass.Active;
    // Get ETL task
    ETLTask := MB.ItemById("ETL").Edit As IEtlTask;
    // Delete ETL task objects
    If EtlTask.Workspace.Shapes.Count > 0 Then
        j := EtlTask.Workspace.Shapes.Count - 1;
        For i := j To 0 Step - 1 Do
            EtlTask.Workspace.Shapes.Item(i).Delete;
        End For;
    End If;
    If EtlTask.Count > 0 Then
        k := EtlTask.Count - 1;
        For i := k To 0 Step - 1 Do
            EtlTask.Item(i).Remove;
        End For;
    End If;
    // Create an EXCEL data provider
    ETLProvider := ETLTask.Create(EtlObjectType.PlainDataExcelProviderEx) As IEtlPlainDataProvider;
    ETLProvider := ETLProvider.Edit;
    ETLProvider.Id := "Excel_Provider";
    ETLProvider.Name := "Excel_Provider";
    dtProv := ETLProvider.Provider As IDtExcelProviderEx;
    dtProv.File := "C:\Prov.xlsx";
    dtProv.Format := "xlsx";
    dtProv.Sheet := "Sheet1";
    dtProv.FieldsFromFile;
    // Enable file request on ETL task execution
    QueryForFile := ETLProvider As IEtlPlainDataForceQueryForFile;
    QueryForFile.ForceQuery := True;
    // Fill fields from provider
    ETLProvider.FillFromSource;
    // Save provider
    ETLProvider.Save;
    // Create an EXCEL data consumer
    ETLConsumer := ETLTask.Create(EtlObjectType.PlainDataExcelConsumer) As IEtlPlainDataConsumer;
    ETLConsumer := ETLConsumer.Edit;
    ETLConsumer.Id := "Excel_Consumer";
    ETLConsumer.Name := "Excel_Consumer";
    dtCons := ETLConsumer.Consumer As IDtExcelConsumer;
    dtCons.File := "C:\Cons.xls";
    dtCons.Table := "Sheet1";
    // Create a visual representation of data provider
    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(00);
    WxProvider.Extension := WxETLProvider As IWxShapeExtension;
    // Create a visual representation of data consumer
    WxConsumer := EtlTask.Workspace.CreateRectangle;
    WxETLConsumer := New WxETLObject.Create;
    WxETLConsumer.ETLObject := EtlConsumer;
    WxConsumer.Style.TextPosition := WxTextPosition.Bottom;
    WxConsumer.Style.PictureMarginTop := -10;
    WxConsumer.PinPosition := New GxPointF.Create(500);
    WxConsumer.Extension := WxETLConsumer As IWxShapeExtension;
    // Create a link and its visual representation
    ProvPlainOutput := EtlProvider.PlainOutput;
    ConsPlainInput := EtlConsumer.PlainInput;
    PlainLink := EtlTask.CreatePlainLink;
    PlainLink.DestinationObjectInput := ConsPlainInput;
    PlainLink.SourceObjectOutput := ProvPlainOutput;
    ConsPlainInput.Fields.Fill(ProvPlainOutput.Fields);
    // Link data provider and data consumer fields
        For i := 0 To EtlProvider.PlainOutput.Fields.Count - 1 Do
            ETLSrcF := EtlConsumer.PlainInput.Fields.Item(i);
            ETLDestF := EtlProvider.PlainOutput.Fields.Item(i);
            FieldMapping := PlainLink.Link(EtlConsumer.PlainInput.Fields.Item(i));
            FieldMapping.Type := EtlPlainLinkFieldMappingType.Field;
            FieldMapping.Field := EtlProvider.PlainOutput.Fields.Item(i);
        End For;
    WLink := EtlTask.Workspace.AutoLinkShapes(WxProvider, WxConsumer);
    WLink.Style.LinePenBeginWxCap := WxLineCap.Flat;
    WLink.Style.LinePenEndWxCap := WxLineCap.Arrow30DegreeFilled;
    WxETLLink := New WxEtlObject.Create;
    WxETLLink.EtlObject := PlainLink;
    WLink.Extension := WxETLLink As IWxShapeExtension;
    // Save consumer
    ETLConsumer.Save;
    // Save ETL task
    (ETLTask As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the EXCEL Provider object, the EXCEL Consumer object and link between them are created in the ETL task. Files are set for data provider and data consumer; it is also specified for the data provider whether a file must be selected on ETL task execution.

See also:

IEtlPlainDataForceQueryForFile