Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

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

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 68,536 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 58,864 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;
            }

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

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

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,277 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,135 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans