How-to Customize Item Label (Report Print)

Minimum Requirements

  • Extension version MOB5.46
  • Business Central 20.0

Description

Modify an existing Report Print standard report, to include more information in the layout and barcode.

Available reports:  Standard Label Reports (Report Print)
 
See also: Microsoft Learn Reports overview

Use case

In this example, we extend the "Mobile WMS - Item Label Report" with two new fields in the dataset.

The new fields will then be used in both the updated layout and the encoded GS1 DataMatrix barcode.


Standard layout (before):


Customized layout (after):

How to customize the report

Step 1: Create a new Report Extension Object

  • Add new dataitems to the dataset
  • Add code to encode additional values into the GS1 datamatrix barcode (optional)

Step 2: Modify RDLC layout

  • Modify the existing layout or create a new layout


Step 1: Create a new Report Extension object

Using the Report Extension object you can add additional fields to the dataset and request page etc.


reportextension 51065 "MOB Item Label Ext" extends "MOB Item Label"
{
    //
    // [How to] [How-to: Extend Mobile WMS Report and Barcode]
    //

    dataset
    {
        // Add changes to dataitems and columns here
        add(Item)
        {
            // Add a new standard field to dataset
            column(BaseUom; "Base Unit of Measure")
            {
            }

            // Add a new custom field to dataset
            column(ItemVersion; ItemVersionReq)
            {
            }
        }

        modify(Item)
        {
            trigger OnBeforeAfterGetRecord()
            begin
                // You can add and encode you own values to the barcode used in the report.
                // Example, add custom Ai 96 + 97 and values to be encoded.
                if ItemVersionReq <> 0 then
                    Add_CustomAiAndValue('96', Format(ItemVersionReq, 0, 9));

                Add_CustomAiAndValue('97', Item."Base Unit of Measure");
            end;
        }
    }

    requestpage
    {
        // Add you custom field to the requestpage here
        layout
        {
            addafter(OptionalValues)
            {
                // Add field from table extension to request page
                field(ItemVersion; ItemVersionReq)
                {
                    Caption = 'Item Version Number', locked = true;
                    ApplicationArea = All;
                }
            }
        }
    }
    var
        ItemVersionReq: Integer;
}


Encode custom value to GS1 Datamatrix barcode (optional)

The barcode is encoded with several standard values from the Item Label report object.

You can add custom values to be encoded using the procedure as shown in the code from step 1.


trigger OnBeforeAfterGetRecord()
begin
    // You can add and encode your values to the report's barcode.
    // Example, add custom Ai 96 + 97 and values to be encoded.
    if ItemVersionReq <> 0 then
        Add_CustomAiAndValue('96', Format(ItemVersionReq, 0, 9));
    Add_CustomAiAndValue('97', Item."Base Unit of Measure");
end;

Step 2: Modify RDLC layout 

Create a new RDLC layout and add the new custom fields from the dataset to the layout.