Business Central 2021 wave 2 (BC19.1) new features: Using 2D barcodes Font in BC Online/SaaS (Aztec, Data Matrix, Maxi Code, PDF417, QR-Code)

Dynamics 365 Business Central

Hi, Readers.
Today I am very excited to bring you good news. We can finally use 2D barcodes fonts directly on BC Cloud without any external services.

As you might know, Microsoft brought us the 1D barcode during the BC18 Release six months ago, which was a very good start.
More details: Use one-dimensional barcodes in reports (Business Central online)

In July, Kennie brought me the update that the 2D barcode will come to BC.
More details: Dynamics Yammer group.


Dynamics 365 Business Central 2021 release wave 2 CU01 SaaS (BC19.1) is generally available yestaday. Learn more: Cumulative Update Summary for Microsoft Dynamics 365 Business Central(November, 2021)

And the 2D barcodes Font is finally released.
Use two-dimensional barcodes in reports (Business Central online):

Business value:

Customers can now add two-dimensional barcodes to reports.

Feature details:
This release wave adds fonts to generate two-dimensional barcodes in Business Central production and sandbox environments. This means that any custom layouts using the fonts will work.

We have licensed the font packages provided by IDAutomation Inc.

We also have added a new AL module to make it easy for developers to encode strings in the different barcode symbologies that the fonts support.

The standard source code of barcodes: ALAppExtensions/Modules/System/Barcode/src at main · microsoft/ALAppExtensions · GitHub

You can find new Enum “Barcode Symbology 2D” and Interface “Barcode Font Provider 2D” in BC19.1 now.

enum 9205 “Barcode Symbology 2D”:

interface “Barcode Font Provider 2D”

So you can use the following symbologies: No dotcode?

  • QR-Code
  • Aztec
  • PDF417
  • DataMatrix
  • MaxiCode

Let’s do a small test like doing in 1D Barcodes.

First, create a new report to show Item number.

report 50100 ItemBarCode
{
    UsageCategory = Administration;
    ApplicationArea = All;
    DefaultLayout = RDLC;
    Caption = 'Item Barcodes';
    RDLCLayout = 'ItemBarcodes.rdl';
    dataset
    {
        dataitem(Item; Item)
        {
            DataItemTableView = sorting("No.");
            RequestFilterFields = "No.";
            RequestFilterHeading = 'Items';
            column(No_; "No.")
            {
            }
            column(Description; Description)
            {
            }
            column(Aztec; Aztec)
            {
            }
            column(DataMatrix; DataMatrix)
            {
            }
            column(MaxiCode; MaxiCode)
            {
            }
            column(PDF417; PDF417)
            {
            }
            column(QRCode; QRCode)
            {
            }
            trigger OnAfterGetRecord()
            begin
                GenerateAztec();
                GenerateDataMatrix();
                GenerateMaxiCode();
                GeneratePDF417();
                GenerateQRCode();
            end;
        }
    }
    local procedure GenerateAztec()
    var
        BarcodeSymbology2D: Enum "Barcode Symbology 2D";
        BarcodeFontProvider2D: Interface "Barcode Font Provider 2D";
        BarcodeString: Text;
    begin
        BarcodeFontProvider2D := Enum::"Barcode Font Provider 2D"::IDAutomation2D;
        BarcodeSymbology2D := Enum::"Barcode Symbology 2D"::Aztec;
        BarcodeString := Item."No.";
        Aztec := BarcodeFontProvider2D.EncodeFont(BarcodeString, BarcodeSymbology2D);
    end;

    local procedure GenerateDataMatrix()
    var
        BarcodeSymbology2D: Enum "Barcode Symbology 2D";
        BarcodeFontProvider2D: Interface "Barcode Font Provider 2D";
        BarcodeString: Text;
    begin
        BarcodeFontProvider2D := Enum::"Barcode Font Provider 2D"::IDAutomation2D;
        BarcodeSymbology2D := Enum::"Barcode Symbology 2D"::"Data Matrix";
        BarcodeString := Item."No.";
        DataMatrix := BarcodeFontProvider2D.EncodeFont(BarcodeString, BarcodeSymbology2D);
    end;

    local procedure GenerateMaxiCode()
    var
        BarcodeSymbology2D: Enum "Barcode Symbology 2D";
        BarcodeFontProvider2D: Interface "Barcode Font Provider 2D";
        BarcodeString: Text;
    begin
        BarcodeFontProvider2D := Enum::"Barcode Font Provider 2D"::IDAutomation2D;
        BarcodeSymbology2D := Enum::"Barcode Symbology 2D"::"Maxi Code";
        BarcodeString := Item."No.";
        MaxiCode := BarcodeFontProvider2D.EncodeFont(BarcodeString, BarcodeSymbology2D);
    end;

    local procedure GeneratePDF417()
    var
        BarcodeSymbology2D: Enum "Barcode Symbology 2D";
        BarcodeFontProvider2D: Interface "Barcode Font Provider 2D";
        BarcodeString: Text;
    begin
        BarcodeFontProvider2D := Enum::"Barcode Font Provider 2D"::IDAutomation2D;
        BarcodeSymbology2D := Enum::"Barcode Symbology 2D"::PDF417;
        BarcodeString := Item."No.";
        PDF417 := BarcodeFontProvider2D.EncodeFont(BarcodeString, BarcodeSymbology2D);
    end;

    local procedure GenerateQRCode()
    var
        BarcodeSymbology2D: Enum "Barcode Symbology 2D";
        BarcodeFontProvider2D: Interface "Barcode Font Provider 2D";
        BarcodeString: Text;
    begin
        BarcodeFontProvider2D := Enum::"Barcode Font Provider 2D"::IDAutomation2D;
        BarcodeSymbology2D := Enum::"Barcode Symbology 2D"::"QR-Code";
        BarcodeString := Item."No.";
        QRCode := BarcodeFontProvider2D.EncodeFont(BarcodeString, BarcodeSymbology2D);
    end;

    var
        Aztec: Text;
        DataMatrix: Text;
        MaxiCode: Text;
        PDF417: Text;
        QRCode: Text;
}

Then create a new layout:

My test fonts:

Aztec: IDAutomation2D

Data Matrix: IDAutomation2D

Maxi Code: IDAutomation MaxiCode

PDF417: IDAutomation2D

QR-Code: IDAutomation2D

Print in BC:

Test video:

Give it a try!!!🎉🎉🎉🎉🎉🎉

PS:
1. You can learn more about the licensed software here: 2D Universal Barcode Font & Encoder | IDAutomation

2. As of now, MS Docs Adding Barcodes to Reports has not been updated (2021/11/24)

3. In interface “Barcode Font Provider 2D”, there is no ValidateInput procedure.

interface “Barcode Font Provider”:

4.Try to scan some 2D barcodes:

END

Hope this will help.

Thanks for reading.

ZHU

コメント

タイトルとURLをコピーしました