Skip to main content

Notifications

Business Central forum
Answered

Report Extension Add Custom fields from other table to report dataset (repost)

editSubscribe (2) ShareShare
ReportReport
Posted on by 10
Sorry for the repost!
My previous question did not include the description for some reason so thought a repost might work abit better then just editing the post.

So basically i am attempting to create a report extension for Pick Instructions report.
I am attempting to add the LotNo field to the Pick Instructions Report via ReportExtension. I am able to get columns added from the pre existing tables. I am using DataItemLink and dataitem to display the lot No. with the following code. 
 
reportextension 50102 PickInstructionExt extends /Pick Instruction/
{
    dataset
    {
        add(/Sales Line/)
        {
            column(itemNo1; /No./)
            {
                IncludeCaption = true;
            }
        }
        addlast(/Sales Line/)
        {
            dataitem(/item/; /Item/)
            {
                DataItemLink = /No./ = FIELD(/No./);
                column(itemNo2; /No./)
                {
                    IncludeCaption = true;
                }
                dataitem(/Reservation Entry/; /Reservation Entry/)
                {
                    DataItemLink = /Item No./ = FIELD(/No./);
                    column(LotNumber; /Lot No./)
                    {
                        IncludeCaption = true;
                    }
                }
            }
        }

So the column I created being itemNo1 displays the No. however any column I try add in the addlast(/Sales Line/) always displays as blank. I added column itemNo2 to test to see if the issue is the way i linked from sales line to Lot No. However even the link from sales line to item and then grabbing the No. from item shows up blank. 

I am updating the report using microsft report builder and it is showing the columns I added in datasets. I have tried dragging directly from that to the report where it uses =First(Fields!LotNumber.Value)
I have also tried =Fields!LotNumber.Value with no success. Currently im just trying to see if I can pull anything at all from a table that isnt already in the pick instructions report. 
I dont even know where to debug any further haha
Categories:
  • CS-08050546-0 Profile Picture
    CS-08050546-0 10 on at
    Report Extension Add Custom fields from other table to report dataset (repost)
    Hi, Thank You Yun Zhu, seen some of your other work and that's exactly how I ended up debugging it and is a great way of doing it alongside working with bcentral.dev for the ERD. Thanks for the assistance!

    The code wasn't 100% correct so thought I'd share the full code for anyone seeing this in the future.  
     
            addlast("Sales Line")
            {
                dataitem("Reservation Entry"; "Reservation Entry")
                {
                    DataItemLink = "Item No." = FIELD("No."), "Source ID" = FIELD("Document No.");
                    column(LotNumber; "Lot No.")
                    {
                        IncludeCaption = true;
                    }
                    column(baseQuantity; "Quantity (Base)")
                    {
                        IncludeCaption = true;
                    }
                    column(sourceId; "Source ID")
                    {
                        IncludeCaption = true;
                    }
                }
            }


     
  • Verified answer
    YUN ZHU Profile Picture
    YUN ZHU 60,818 Super User on at
    Report Extension Add Custom fields from other table to report dataset (repost)
    Hi, you can use the following method to check if there is a value.
    Dynamics 365 Business Central: Save report dataset to Excel from the request page (Report Inspector)
     
    Hope this can give you some hints.
    Thanks.
    ZHU

Helpful resources

Quick Links

Take the Community feedback survey!

Answer this brief 15-question survey about your Community experience…

Demystifying Copilot: Service Edition with Sundar Raghavan

Sundar answers more questions about Copilot for Service...

Dynamics 365 Business Central vs Finance and SCM

Take a look at the key differences between Business Central and…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,375 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,308 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,140

Featured topics

Product updates

Dynamics 365 release plans