Skip to content
Fast data import with BeyondDataImporter

Lets import Data in a minute

Daniel Gorski
Daniel Gorski 11. Juni 2024
2 Min. Lesezeit

BeyondDataImporter for Microsoft Dynamics 365 Business Central provides an interface called "BYD DI IProcessor" which allows for streamlined and efficient data import into Business Central tables.

Wondering how fast an implementation could be?

Write an enumextension:

enumextension 60000 "PC PostCode" extends "BYD DI Processor"
{
    value(60000; PostCode)
    {
        Caption = 'Post Code';
        Implementation = "BYD DI IProcessor" = "PC Post Code Processor";
    }
}

And implement the following interface:

interface "BYD DI IProcessor"
{
    procedure GetTableNo(): Integer;
    procedure GetTemplateFields(var Rec: Record "BYD DI Template Field" temporary);
    procedure OnChunkLoaded(Rec: Record "BYD DI Template"; Chunk: JsonArray);
    procedure OnImportFinished(Rec: Record "BYD DI Template");
}

Here’s a breakdown of the key components and functionalities:

1. Interface Implementation:

  • "BYD DI IProcessor" indicates that this codeunit conforms to the interface, requiring specific methods to be implemented for processing data.

2. Procedures and Functions:

  • GetTableNo(): Returns the ID of the "Post Code" table.
  • GetTemplateFields(...): Sets up the fields used in the import, including required/optional fields, and any relations.
  • OnChunkLoaded(...): Called when a chunk of data is loaded.
  • ProcessChunk(...): Processes each piece of the JSON data and maps it to the "Post Code" table.
  • OnImportFinished(...): Finalizes the import and reports created/updated records.

3. Data Processing:

  • ProcessChunk uses RecordRef and FieldRef to handle dynamic field assignment based on field type (Integer, Decimal, Boolean, Date, etc.).
  • Uses ConfigValidateMgt.EvaluateTextToFieldRef for type-safe conversion and validation.

4. Error Handling and Updates:

  • Checks for existing records by key (e.g. "Code" + "City") and updates or inserts as needed.
  • Tracks how many records were inserted/updated.

5. Performance Optimization:

  • Uses temporary tables and indirect references for efficient batch handling.
  • Ideal for large imports and background jobs.

And this is how it looks like:

Take our implementation code for free:

https://github.com/byndit/DataImporter-PostCode

Overall, the codeunit is designed for efficiency and flexibility, allowing easy adaptation for importing different datasets by merely implementing the necessary interface and adjusting field mappings and processing logic.

how-to
development
data import
business central
beyonddatimporter
json
interface
GoBD-konforme Archivierung mit Business Central und SharePoint ohne DMS

Architektur

Revisionssicher archivieren ohne DMS? Wie weit Business Central, SharePoint und Azure Blob Storage wirklich tragen

Warum „GoBD" oft vorschnell zum K.O.-Kriterium wird – und wie weit Business Central, SharePoint und Azure Blob Storage wirklich tragen.

Read More: Revisionssicher archivieren ohne DMS? Wie weit Business Central, SharePoint und Azure Blob Storage wirklich tragen
Read More: Revisionssicher archivieren ohne DMS? Wie weit Business Central, SharePoint und Azure Blob Storage wirklich tragen
Modulare ERP-Architektur für skalierbare Unternehmenssoftware

Architektur

Mehr als nur Warenwirtschaft - die Landtechnik Lösung

ERP-Systeme wurden jahrelang als Monolithen verkauft. Die eigentliche Stärke moderner Plattformen wie Business Central liegt jedoch in der Modularität - und gen

Read More: Mehr als nur Warenwirtschaft - die Landtechnik Lösung
Read More: Mehr als nur Warenwirtschaft - die Landtechnik Lösung