Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

How to add a field from another table in a report extension.

(1) ShareShare
ReportReport
Posted on by 9
I want to create a new Pys. Inventory List with 2 other fields that are in the Item table.
/No./ is already there, but I also need /No. 2/ and /Item Category Code/
 
reportextension 50105 TellelisteEXT extends 722
{
    dataset
    {
        add(/Item Journal Line/)
        {
            column(ItemNo2_ItemJournalLine; item./No. 2/)
            { }
            column(ItemCatCode_ItemJournalLine; item./Item Category Code/)
            { }
        }
    }
 
    requestpage
    {
        // Add changes to the requestpage here
    }
 
    rendering
    {
        layout(LayoutName)
        {
            Type = RDLC;
            LayoutFile = 'Telleliste.rdl';
        }
    }
}
  • How to add a field from another table in a report extension.
    Thanks! That put me on the right track and I was able to get the correct fields :)
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 76,221 Super User 2024 Season 2 on at
    How to add a field from another table in a report extension.
    Hi, try the following.
    reportextension 50118 MyExtension extends "Phys. Inventory List"
    {
        dataset
        {
            addfirst("Item Journal Line")
            {
                dataitem(Item; Item)
                {
                    DataItemLink = "No." = field("Item No.");
                    DataItemLinkReference = "Item Journal Line";
    
                    column(ItemNo; Item."No.")
                    { }
                }
            }
        }
    }
     
    Hope this helps.
    Thanks.
    ZHU
  • How to add a field from another table in a report extension.
    I only get this error with or without your code:
    error AL0161: 'Item' is inaccessible due to its protection level
     
    So if I press CTRL+F5 it starts compiling and gives the error.
     
    With your code before or after "add" I get that same error twice:
    \Phys.Inv.List.Ext.al(14,45): error AL0161: 'Item' is inaccessible due to its protection level
    \Phys.Inv.List.Ext.al(16,49): error AL0161: 'Item' is inaccessible due to its protection level
  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 60,062 Super User 2024 Season 2 on at
    How to add a field from another table in a report extension.
    Did you get item record anywhere?
    You may have to get it like
            modify("Item Journal Line")
            {
                trigger OnBeforeAfterGetRecord()
                begin
                    item.Get("Item No.");
                end;
            }

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,605 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans