www.qucamba.com
Level: Beginners
Language: English
Things you will learn in this tutorial:
The "Copy Report" tool which is located in the "Tools" section of the "START" ribbon can now be used to create an entirely new report based on an existing one.
This tool allows copying all content of an existing report, such as
The copied items are placed directly in the current app and the copy is wired-up correctly so that the copy works with the new layout files as well as with the new translations without the user having to customize this. Translations can either be copied to the app’s translation files or to separate files for later merge.
Before using the "Copy Report" tool, we recommend making a backup of your app.
There are three ways to use the copy tool:
To copy a report by using the Copy Report wizard, select the "START" ribbon menu and click on "Copy Report" located in the Tools ribbon group.
Follow the steps as explained by the wizard and select the content you want to copy.
First, select the source report that is to be copied. Then, select which content you want to copy and click Next.
In the next wizard step, enter name and id for the new report.
Pick an available id from the list or enter the id you want to assign to the new report. In the name field, remember using your app’s prefix or suffix. Then, click Next.
In this wizard step, you can check the substitution option which generates AL code that registers an event subscriber that replaces the original report with your new copy. Regardless of how the user attempts to start the original report, all executions of the original report will be redirected and will launch your customized report copy.
The required code needs to reside in a codeunit. In this wizard step, enter id and name for the codeunit to create. Again, remember adding your app’s prefix or suffix to the object’s name.
Click Next to go to the wizard’s summary before proceeding with Finish.
After the wizard processed the copy operation, it opens the copy of the report in the PREVIEW. From here, you may want to either click the "Open in Code" action to examine the AL code in Visual Studio Code or click the "Open in Designer" action to edit the RDLC layout.
Depending on the source report’s AL code, when compiling your app the compiler might come up with some errors. This e.g. happens if the source report calls code that is only visible to internals or if it uses DotNet functionality while your app is configured to not support DotNet (depending on the target-key in your app.json file). In these cases, correct the errors and re-compile your app.
Conclusion
It has never been that easy to copy a report containing all of its content to a new report object. Of course, one could also copy all the parts of a report manually but as soon as it comes to translations this is going to be a tedious job. Using the Copy Report wizard instead, the developer can focus on his job: creating and designing reports.