Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Cant get field references on reportExtension in vsCode

Posted on by 25

I am extending a report from Warehouse Insight so I can use there barcode generator.

I can product a barcode using this method but I am having trouble getting additional fields from the Item table and linking them to the barcode text.

barcodeText := itemGTIN   variable   itemDesciption   variable   Format(itemWeight, 9)   variable   "Country/Region Code"   variable   "Lot No.";

Fields from the diItemLedgerEntry work fine. But GTIN, Description and Gross Weight from Item are not showing up.
This is my report extension.
I understand the variables added at end are probably not correct. I was just testing many different things
reportextension 50202 "AM Item Barcode Label" extends "WHI Item Barcode Label"
{
    RDLCLayout = 'AM Item Barcode Label.rdlc';

    dataset
    {

        addfirst(diItemLedgerEntry)
        {
            dataitem(Item; Item)
            {
                DataItemLink = "No." = field("Item No.");
                DataItemTableView = sorting("No.");
                column(GTIN; GTIN) { }
                column(Gross_Weight; "Gross Weight") { }
                column(Description; Description) { }

                trigger OnPreDataItem()
                begin
                    itemGTIN := GTIN;
                    itemWeight := "Gross Weight";
                    itemDesciption := GTIN;
                end;
            }
        }

        add(diItemLedgerEntry)
        {
            column(barcodeImage; Barcode.Image)
            {
            }
            column(barcodeText; barcodeText)
            {
            }

        }

        modify(diItemLedgerEntry)
        {

            trigger OnAfterAfterGetRecord()
            var
                BarcodeGeneration: Codeunit "IWX Library - Barcode Gen";
                variable: Text;
            begin
                variable[1] := 10;
                barcodeText := itemGTIN   variable   itemDesciption   variable   Format(itemWeight, 9)   variable   "Country/Region Code"   variable   "Lot No.";
                //Item.GTIN   variable   "Description"   variable   Format(Item."Gross Weight", 9)
                BarcodeGeneration.GenerateQRBarcode(Barcode, barcodeText, 220);
            end;
        }


    }

    var
        Barcode: Record "IWX Barcode" temporary;
        barcodeText: Text;
        itemGTIN: Text;
        itemWeight: Decimal;
        itemDesciption: Text;

}
Here is the report im extending from
report 23044900 "WHI Item Barcode Label"
{
  RDLCLayout = 'source/reports/WHI Item Barcode Label.rdlc';
  Caption = 'Warehouse Insight Item Barcode Label';

  dataset
  {
    dataitem(diItem; Item)
    {
      column(diItem_No_;'Code[20]')
      {
      }
    }
    dataitem(diItemLedgerEntry; "Item Ledger Entry")
    {
    }
    dataitem(diLabels; Integer)
    {
      dataitem(diNumCopies; Integer)
      {
        column(trecItems_No;'Code[20]')
        {
        }
        column(trecItems_Description;'Text')
        {
        }
        column(trecItems_Routing;'Code[50]')
        {
        }
        column(fldBarcode;'Blob')
        {
        }
        column(fldLotSerialBarcode;'Blob')
        {
        }
        column(diNumCopies_Number;'Integer')
        {
        }
        column(fldQuantity;'Decimal')
        {
        }
        column(fldUnitOfMeasure;'Code[10]')
        {
        }
        column(fldIncludeQty;'Boolean')
        {
        }
        column(fldExpiryDate;'Text')
        {
        }
      }
    }
  }
  requestpage
  {
    layout
    {
      area(content)
      {
        group(Options)
        {
          Caption = 'Options';

          field(fldNumCopies; iNumCopies)
          {
            Caption = 'Number of Copies';
          }
          field(fldIncludeQty; bIncludeQty)
          {
            Caption = 'Include Quantity';
          }
        }
      }
    }
  }
  var trecItems: Record Item temporary;
  recWHISetup: Record "WHI Setup";
  trecBarcode: Record "Company Information" temporary;
  trecLotSerialBarcode: Record "Company Information" temporary;
  cuWHICommon: codeunit "WHI Common Functions";
  cuSessionHelper: codeunit "WHI Session Helper";
  iNumCopies: Integer;
  iCount: Integer;
  bIncludeQty: Boolean;
  tcOnlyOneFilterErr: Label;
  dQuantity: Decimal;
  codUOM: Code[10];
  codTrackingNumber: Code[50];
  dtExpiryDate: Date;
  sExpiryDate: Text;
}

  • Suggested answer
    Andy Sather Profile Picture
    Andy Sather on at
    RE: Cant get field references on reportExtension in vsCode

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    I will open this up to the community in case they have something to add.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans