In this blog, we will learn how to Create a displayed barcode in RDLC Report.
So basically, the barcode is a way of representing the data in form of lines. Any Alpha-Numeric string can be encoded into a barcode and displayed. For encoding, we have Interface in Business Central.
We will be creating a sales report in this blog.
This is the Format of the sales report.
So, let us see what coding we needed to do for encoding the sales invoice number.
In the On After Get Record trigger we are encoding the sales invoice number. The interface ‘Barcode Font Provider’ is predefined in Business Central.
And an Enum is needed to encode the barcode which is used to define the 1-dimension or 2-dimension barcode we need to create. Here we are using a 1D barcode. And another Enum will show the Babar code symbology of Code39. It is used for alphanumerical strings.
We then pass the Invoice number and the dimension Enum to Validate function which checks if the given data is valid for creating the barcode with the given symbology.
And after validating we then pass the variables to Encode font Function for encoding.
After the Encoding is completed, the encoded text is sent with the dataset to RDLC.
As you can see above the barcode textbox is created inside the rectangle and is hidden. Which is getting the data from business central. And a new textbox is created in the header and enter this expression in the textbox =ReportItems!<textboxname>.Value
And the font for the barcode display will be IDAutomationHC39M.
After that, we will compile and run the report. The barcode will be visible in the header of the report.
Afroz Labbai
D365 Business Central
Addend Analytics