web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Adding table extension fields to a report

(0) ShareShare
ReportReport
Posted on by 135

Hi everyone. Has anyone added data from a table extension to a report and had success?

I've been looking through the forum and saw a couple of threads that talk about creating custom reports but none of them lay out the steps required to link a table extension to a report using al code.

We created a table extension on the sales invoice line and I am trying to add the two fields that we added to the sales invoice form. Here is the code that i've written so far. I'm used to doing things like this in SQL where I'd just need to add a join but AL seems a lot different... any help is appreciated. It's not letting me just add another data item like i did to add the sales invoice line table. 

report 50105 "Sales Invoice Test Report"
{
DefaultLayout = RDLC;
RDLCLayout = 'sales_inv_test.rdl';
dataset
{
dataitem("Sales Invoice Header";"Sales Invoice Header")
{
RequestFilterFields = "No.";
column(No_;"No.")
{
}
column(Sell_to_Customer_No_;"Sell-to Customer No.")
{
}
column(Document_Date;"Document Date")
{
}
column(Amount;Amount)
{
}
column(Remaining_Amount;"Remaining Amount")
{
}
dataitem("Sales Invoice Line";"Sales Invoice Line")
{
DataItemLinkReference = "Sales Invoice Header";
DataItemLink = "Document No." = field("No.");
column(Line_No_;"Line No.")
{
}
column(Description;Description)
{
}
column(Quantity;Quantity)
{
}
column(Unit_Price;"Unit Price")
{
}
// This is where I would expect to link the table extension
// dataitemlinkreference
// dataitemlink
}
}

}
I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Is this report in the same extension of your tableextension object or in another extension (app)?

    If case 1: you should see the added field directly in Sales Invoice Line

    If case 2: you need to add the extension containing your tableextension as dependency of the new extension where you have the report.

  • Michael Scalamogna Profile Picture
    135 on at

    Hey Stefano, thanks for the response. I'm not sure I understand. The table extension is on the sales invoice line table, and one of the dataitems in the report is the sales invoice line. Are you saying that the fields in the table extension should just be available? In VS Code, I get a message that says "the name Gross Quantity does not exist in the current context" when i try to add a column.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Is the report you’re developing in the same extension project as your tableextension object? If so, fields are visible.

    If it’s not in the same extension project but it a new one (new project in VS Code), then you need to add dependency in app.json.

  • Michael Scalamogna Profile Picture
    135 on at

    This worked, thank you! I knew it had to be something simple.

  • Community Member Profile Picture
    on at

    Hi Michael,

    I am facing this issue to add fields from Table Extension to report. 

    Could you please share how this is sorted? 

    Regards,

    Ranjith

  • Suggested answer
    YUN ZHU Profile Picture
    102,079 Super User 2026 Season 1 on at

    Hi, Ranjith ES, a very simple example, hope this helps.

    In AL:

    pastedimage1651712132027v1.png

    In layout file

    pastedimage1651712287122v2.png

    More about report extension: https://yzhums.com/10723/

    Thanks.

    ZHU

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans