microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
733 stars 243 forks source link

Nested repeater in Word Layout #6628

Closed TheHeino closed 4 months ago

TheHeino commented 3 years ago

I want to add some Sales Comment Lines under Sales Line in a report with Word Layout.

I am extending the Standard Sales invoice report (1306) with a new DataItem that I want under Each Line:

reportextension 50100 "SalesInvoiceExt" extends "Standard Sales - Invoice"
{
    dataset
    {
        add(Header)
        {
            column(External_Document_No_; "External Document No.")
            {
            }
            column(Your_Reference; "Your Reference")
            {
            }
        }
        addlast(line)
        {
            dataitem("Sales Comment Line"; "Sales Comment Line")
            {
                DataItemLink = "No." = field("Document No."), "Document Line No." = field("Line No.");
                DataItemLinkReference = line;
                DataItemTableView = sorting("Document Type", "No.", "Document Line No.", "Line No.") where("Document Type" = const("Posted Invoice"));
                column(Comment_; Comment)
                {
                }
            }
        }
    }
}

Simple enough... well it should be :-) This issue has been posted here before - but as far as I can see not solved :-) I get the exact same error as the ones here: https://github.com/Microsoft/AL/issues/3880 But the last comment on that issue was almost a year ago, so perhaps someone has solved it in the meantime?

When I Export the Word Layout from BC and open it I can see that dataitem and field have appeared in the XML mapping - Perfect! image

I add a line to the "Line-repeater" here: image

I delete all the Content controls on the new line and now I have several options: One option is to Open the XML mapping - mark the new line - right click on the Sales_CommentLine and choose "Repeater" - this should be ok. Then inside the new line: Right click on the Comment (under Sales_CommentLine) and choose as Plain text. Beautiful: image Am I really that good? Let's see... Now I save the Layout and believe all is good. I Close MS Word... Just to make sure all is perfect I open the Layout again... and this is how it looks like now: image So appearently it refuses to remember the Comment Content Control :-( When I try to upload it, it imports ok but when I run the report it ignores my changes. If I just hardcode some letters in the Content Control and save the Layout again - it saves it... but this time it gives me the following error when importing it into BC: image

I have also tried creating a Table Inside the second row and "repeated" that - but same problem...

I have also seen this fine video about Nested Repeaters in Word - but appearently we do not agree what Nested Repeaters are :-) https://community.dynamics.com/dynamicbusiness/b/videos/posts/how-do-i-use-nesting-repeaters-in-a-word-layout-in-microsoft-dynamics-nav-2015

Should I really do this in RDL?

Thank you in advance.

Drakonian commented 3 years ago

Try this:

  1. Add control
  2. Select control
  3. Add repeat from control dataitem
  4. Add group only for control
SanderCMD commented 3 years ago

Hey @TheHeino , I know this is very late, but I also had to make something like this this week. I see that the error says something about Header/Line[2]. Maybe you should try to span the two rows when adding the Header/Line repeating control. After that go and select the cells from the 2nd row, and insert the repeating of your Sales_Comment_Line. After that insert the field in the cell.

I think that is how I solved it.

MathurRahul commented 3 years ago

Hello @SanderCMD @TheHeino

I'm encountering the same issue with nested repeaters. Did you manage to fix it? If yes can you please share your solution (with screenshot if possible).

Thank you.

tyurm commented 2 years ago

There is a pretty old blog post written by Luc Van Vugt: https://www.fluxxus.nl/index.php/bc/why-is-the-repeater-in-my-word-layout-not-showing-data/

The solution was - "Make sure when inserting the repeater to have a table row above and below it" It helped me, probably it will help you as well.

thloke commented 4 months ago

Duplicate of #7704