IW Common: Barcode generating with CU-Temp Blob

You are here:

As of Business Central 17.5, the Temp Blob table no longer exists. Any barcode generation that leverages the IWorks Common application library should switch that capturing variable to the Codeunit Temp Blob.

Note: There are advantages to moving over to the Codeunit. Using Codeunit Temp Blob, as shown in this example below, can pass its image to any table that has a BLOB data type field.

Sample code for generating barcodes with IWX Common v2.4 using Codeunit Temp Blob:

report 50000 “Label – Custom”
{
    // version IWX 2.4
    // ************************
    // Copyright Notice
    // This objects content is copyright of Insight Works 2011.  All rights reserved.
    // Any redistribution or reproduction of part or all of the contents in any form is prohibited.
    // ************************
    dataset
    {
        dataitem(diLicensePlate; “IWX LP Header”)
        {
            column(diLicensePlate_No_; “No.”)
            {
            }
            column(diLicensePlateBarcode; trecBarcode.Picture)
            {
            }
            trigger OnAfterGetRecord();
            var
                lcuBarcodeManagement: Codeunit “IWX Barcode Generation”;
                lisInStream: InStream;
                losOutStream: OutStream;
            begin
                //create barcode
                lcuBarcodeManagement.get2dBarCode(
                    cuTempBlob,
                    StrSubstNo(‘%LP%%1’, “No.”),
                    iBarcodeDotSize,
                    iBarcodeMarginSize,
                    iBarcodeImageSize
                );
                trecBarcode.Picture.CreateOutStream(losOutStream);
                cuTempBlob.CreateInStream(lisInStream);
                CopyStream(losOutStream, lisInStream);
            end;
        }
    }
    trigger OnInitReport()
    begin
        //set barcode variables
        iBarcodeDotSize := 2;
        iBarcodeMarginSize := 0;
        iBarcodeImageSize := 0;
    end;
    var
        trecBarcode: Record “Company Information” temporary;
        cuTempBlob: Codeunit “Temp Blob”;
        acodItemNo: array[12] of Text;
        adQuantity: array[12] of Decimal;
        iCount: Integer;
        iBarcodeDotSize: Integer;
        iBarcodeMarginSize: Integer;
        iBarcodeImageSize: Integer;
}
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Need help?

Leave A Comment

Go to Top