Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

ReportExtension Multiple DataItem Issue

Posted on by 15

I am trying to add two DataItems to the existing Assembly Order report in order to show details from the Lot Numbers assigned to both the header (resulting item) and the consumed BOM line items.

reportextension 50050 "Assembly Order Report Ext" extends "Assembly Order"
{
    RDLCLayout = './AssemblyOrder.rdl';

    dataset
    {
        addlast("Assembly Line")
        {
            dataitem(WOHeaderLotNo; "Reservation Entry")
            {
                DataItemLinkReference = "Assembly Header";
                DataItemLink = "Source ID" = field("No.");
                DataItemTableView = where("Source Type" = const(900));
                column(LotNo_AssemblyHeader; "Lot No.") { }
                column(LotQty_AssemblyHeader; "Quantity") { }

                dataitem(WOLineLotNo; "Reservation Entry")
                {
                    DataItemLinkReference = "Assembly Line";
                    DataItemLink = "Source ID" = field("Document No."), "Source Ref. No." = field("Line No.");
                    DataItemTableView = where("Source Type" = const(901));
                    column(LotNo_AssemblyLine; "Lot No.") { }
                    column(LotQty_AssemblyLine; "Quantity") { }
                }
            }
        }
    }
}

When I do it this way with the line item detail DataItem underneath the Header DataItem in the hierarchy, the line item lot details only populate when the header has a Lot number assigned, which isn't ideal. But if I move the line item detail dataitem to be at the same level as the header dataitem (which seems like the right way to do it), then I get a strange unlinked data set - there is a set of rows with the line item detail lot number columns populated but the header lot columns all null, and there is a set of rows with the header lot columns populated but the detail lot columns all null. I would expect there to be a single set of rows that has both the header lot and detail lot columns populated.

Can someone help me set this up properly? Thank you!

  • JaredMiller Profile Picture
    JaredMiller 15 on at
    RE: ReportExtension Multiple DataItem Issue

    Hi, Nitin. Thanks for the suggestion. Unfortunately, this gives me the same issue I described... I get several records with the *_AssemblyHeader columns populated and null for the *_AssemblyLine colums, and then I get the rest of the rows with the *_AssemblyLine columns populated and the *_AssemblyHeader columns null. Any other recommendations?

    Thanks!

    -- Jared

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,025 Moderator on at
    RE: ReportExtension Multiple DataItem Issue

    Hi,

    Please give a try of below code.

    reportextension 50050 "Assembly Order Report Ext" extends "Assembly Order"

    {

       RDLCLayout = './AssemblyOrder.rdl';

       dataset

       {

           addbefore("Assembly Line")

           {

               dataitem(WOHeaderLotNo; "Reservation Entry")

               {

                   DataItemLinkReference = "Assembly Header";

                   DataItemLink = "Source ID" = field("No.");

                   DataItemTableView = where("Source Type" = const(900));

                   column(LotNo_AssemblyHeader; "Lot No.") { }

                   column(LotQty_AssemblyHeader; "Quantity") { }

               }

           }

           addlast("Assembly Line")

           {

               dataitem(WOLineLotNo; "Reservation Entry")

               {

                   DataItemLinkReference = "Assembly Line";

                   DataItemLink = "Source ID" = field("Document No."), "Source Ref. No." = field("Line No.");

                   DataItemTableView = where("Source Type" = const(901));

                   column(LotNo_AssemblyLine; "Lot No.") { }

                   column(LotQty_AssemblyLine; "Quantity") { }

               }

           }

       }

    }

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 228,645 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans