Skip to content

Table 1220 - Data Exch. - [Procedure - ImportToDataExch] (SoftwareOne - Company Details) #30306

Description

@Pardeep-Saini-Soft

Why do you need this change?

Required to allow custom import processing for Data Exchange before standard Codeunit/XMLport import execution.

Describe the request

Current Code
procedure ImportToDataExch(DataExchDef: Record "Data Exch. Def"): Boolean
var
Source: InStream;
ProgressWindow: Dialog;
begin
if not "File Content".HasValue() then
if not ImportFileContent(DataExchDef) then
exit(false);

    ProgressWindow.Open(ProgressWindowMsg);

    "File Content".CreateInStream(Source);
    SetRange("Entry No.", "Entry No.");
    if DataExchDef."Reading/Writing Codeunit" > 0 then
        CODEUNIT.Run(DataExchDef."Reading/Writing Codeunit", Rec)
    else begin
        DataExchDef.TestField("Reading/Writing XMLport");
        XMLPORT.Import(DataExchDef."Reading/Writing XMLport", Source, Rec);
    end;

    ProgressWindow.Close();

    exit(true);
end;

Requested Change
procedure ImportToDataExch(DataExchDef: Record "Data Exch. Def"): Boolean
var
Source: InStream;
ProgressWindow: Dialog;
IsHandled: Boolean;
begin
if not "File Content".HasValue() then
if not ImportFileContent(DataExchDef) then
exit(false);

    **IsHandled := false;
    OnBeforeImportToDataExch(Rec, DataExchDef, IsHandled);
    if not IsHandled then begin
        ProgressWindow.Open(ProgressWindowMsg);**

        "File Content".CreateInStream(Source);
        SetRange("Entry No.", "Entry No.");
        if DataExchDef."Reading/Writing Codeunit" > 0 then
            CODEUNIT.Run(DataExchDef."Reading/Writing Codeunit", Rec)
        else begin
            DataExchDef.TestField("Reading/Writing XMLport");
            XMLPORT.Import(DataExchDef."Reading/Writing XMLport", Source, Rec);
        end;

        ProgressWindow.Close();
    end;

    exit(true);
end;

Requested Event Publisher
[IntegrationEvent(false, false)]
local procedure (var DataExch: Record "Data Exch."; var DataExchDef: Record "Data Exch. Def"; var IsHandled: Boolean)
begin
end;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions