Skip to content
Fast data import with BeyondDataImporter

Lets import Data in a minute

Daniel Gorski
Daniel Gorski June 11, 2024
2 min read

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:

Business Central data import templates list showing a

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.

Related posts

▸ All posts
Upload and download files via BLOB in Business Central

Upload and Download Files in a BC Blob Field

January 29, 2025 · Daniel Gorski

Learn how to upload and download files in Business Central using a custom AL page and a BLOB field—perfect for storing documents, images, and more.

Read More
Read More: How to Upload and Download Files in a Blob Field in Business Central
Set up a custom BC25 repository

BC25 Base App Repo: Find All References in AL

September 19, 2024 · Daniel Gorski

Build your own BC25 repository from the base app, platform packages and assemblies so Find All References works across Microsoft's code in VS Code.

Read More
Read More: Increase Your DEV productivity with your own BC25 REPO
Default Line Type behavior in Business Central

Document Default Line Type in Business Central

May 07, 2024 · Daniel Gorski

The 'Document Default Line Type' in Business Central only applies to the first line. A small AL event subscriber keeps it for every new line.

Read More
Read More: The Line Type Myth: Default Line Types in Business Central