Closed adcprowi closed 2 months ago
Could you also attach a a sample word layout that shows the error? It would help speed up the fix to this issue
I can reproduce this with the layout that you supplied. The reason for the crash is that the layout has a weird custom XML part where we expect the business central specific properties to reside. I can fix the crash so that it gives a nicer error message, but it doesn't address the fact that this layout is malformed. I tried re-creating a similar layout with the steps that you provided, but I couldn't get the same malformed layout.
I assume there was nothing special about the steps you took to create the repeater? I.e. - the steps you took follow the ones outlined here: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-howto-report-layout#using-tables-to-display-data-from-the-report-dataset-simple-repeaters
If so, can you try to re-create the word layout again and see if you can consistently reproduce the crash?
Ignore all of that, I completely overlooked the most important step:
Add a new row within the repeater control.
You even highlighted it for me, sorry. :( I can repro the same behaviour now.
The reason why this breaks is that when you add a new line to a repeater in Word, it inserts a duplicate element which causes the exception in our compiler. I've fixed the issue where the compiler throws an exception, but it will not address the fact that there is a duplicate element which even if we allow for compilation (we do not), the server will reject.
So in short, the fix for this will be simply to have no unhandled exception but it won't change the fact that the layout will be invalid. Allowing duplicate elements is a bigger problem and the fix will have to involve the server as well. We could delete the duplicate element but that would be a destructive change on the layout which has its own perils with destroying user data.
I'm surprised we haven't run into this before.
Thanks for looking into this. I do believe there's more to this issue. This error message has been referenced in the past for similar use cases: https://github.com/Microsoft/AL/issues/3880#issuecomment-611371338
The reason for the duplicate element is because I've been trying to create a nested repeater in different ways.
This time I created a table with 2 rows first and put the sales line repeater around these 2 rows. I created the nested repeater inside of the second row and added some data.
When I run this report the output is completely blank. (I can see sales line and reservation entry data in the xml output)
It should be possible to create a nested repeater in the word layouts according to the documentation. The steps to create a nested repeater are not specified here but I've looked at feedback from similar issues and nothing seems to work. https://github.com/microsoft/AL/issues/6628 https://github.com/Microsoft/AL/issues/3880
There's more strange behaviour that makes me think something is not right.
I recreated the word file from scratch and added a new table.
When I add the repeating content control the xml mapping is not shown.
I need to close the word file and rebuild my AL application to apply the mapping.
Can you please check if you are able to create and display a nested repeater? Here's my word layout based on the same code: StandardSalesOrderConfirmation.docx
@KennieNP - Do we have docs on creating nested repeaters in Word layouts? I'm not too familiar with this.
The fix for this issue has been checked in to the master branch. It will be available in the bcinsider.azurecr.io/bcsandbox-master Docker image starting from platform build number 25.0.18404.0 and VS Code Extension Version 14.0.986719.
If you don’t have access to these images you need to become part of the Ready2Go program: aka.ms/readytogo
For more details on code branches and docker images please read: https://blogs.msdn.microsoft.com/nav/2018/05/03/al-developer-previews-multiple-releases-and-github/ https://freddysblog.com/2020/06/25/working-with-artifacts/
1. Describe the bug The package can not be created after adding a new row in a repeating section for a word layout. The following error is displayed:
2. To Reproduce
StandardSalesOrderConfirmation.docx
3. Expected behavior The package should be created. My goal was to add a nested repeater inside of the second row which contains data from the reservation entries linked to the sales line.
4. Actual behavior The package is not created after adding a new row to the repeater control and an error message is displayed.
5. Versions: