Damn it. I gave everything to write 10 tips together, but in the end there were only 9. Reports can drive you to despair in AL. While extensions have been available for tables and pages for a long time, we have to be patient with reports until the following screenshot of a report extension becomes reality.
To make your life as easy as possible until then, I’d like to share a few tips for developing reports in AL. For some of you there might be nothing new, but some of you might take something with you.
All right. Let’s go.
#1 Navigate Through Your Symbols with Ctrl + Shift + O
Reports can have a high complexity. The standard “Sales – Order Conf.” (Report 1305) in Business Central has 5 DataItems. This makes it difficult to navigate through the different DataItems, triggers and other code locations.
Therefore, it is advisable to use the command “Go to Symbol in Editor…”. (Ctrl + Shift + O). The command shows you a list of your symbols and allows you to search the symbols.
For example, you can search for “@onafter” and quickly jump to your OnAfterGetRecord triggers.
You can quickly jump to your request page with the search term “@req”.
…or even search for the individual fields in your request page.
#2 Jump To The Start/End Of Your DataItem With Ctrl + Shift + ^
This one will be new for some people. With the command “Go to Bracket” (Ctrl + Shift + ^) you can comfortably jump either to the end or start of an indentation or bracket.
For example, if you stand in the beginning bracket of your DataItem (line 13) and execute the command, your cursor will be moved to the end of the DataItem – where the triggers are located. Cool shit, right?
#3 Jump To The Start Of Your Global Variables With Ctrl + G
If you have a report with more than 1000 lines, you may not always want to scroll to your global variables. Use Rasmus Aaen’s Variable Helper to jump to the beginning of your global variables.
The command “AL-Var: Global Variables” (Ctrl + G) is a real time saver…
…and gets you over here real quick:
#4 Jump To The End Of Your Global Variables With Ctrl + Alt+ G
If you have many variables in your report, it might not be enough to jump to the beginning of these variables. Use my extension AL Navigator to jump to the end of your variables.
The extension provides a command “AL: Navigator: Last global var line” (Ctrl + Alt + G).
#5 Jump Through Your DataItems With Ctrl + Alt + D Or Shift + Alt + D
My extension AL Navigator offers other functionalities. Use the commands “AL Navigator: Next DataItem (starting from bottom)” (Shift + Alt + D) or “AL Navigator: Next DataItem (starting from top)” (Ctrl + Alt + D) to “jump” through your DataItems.
With each call of the command the cursor jumps to the next DataItem:
#6 Add New Variables With The Quick Fix Lamp (Ctrl + .)
Sometimes you just want to pass a new variable as column in the dataset. You can use the CodeAction “Add global Variable” of the AL Navigator to create the new variable from the column. Pretty comfortable, isn’t it? 😉
Of course this CodeAction also works in functions and triggers, as you can see below. In the following gif I am standing in the OnInitReport-Trigger and create a global record “Company Information” from there.
#7 Translate Your Copied Standard Report With Poedit
As long as we don’t have report extensions, we have to copy standard reports to customize them. Unfortunately the copied reports are not automatically translated. Use Poedit to automatically add the translations for the copied standard reports. In this tutorial I explained how this works.
#8 Export Your Dataset By Using The Mini Report Inspector
In the Windows client we were able to view the dataset of a report. In the Web Client this is no longer possible in the standard. However, Steven Renders has built a Mini Report Inspector that we can integrate into our custom reports. With it we are able to view our datasets. You can find the GitHub project for the Mini Report Inspector here. In this link Steven Renders describes the Mini Report Inspector. Extremely useful!
#9 Create Regions for AL DataItems and Columns with AL Toolbox
In the extension AL Toolbox by Bart Permentier you can find another gem – the command “ALTB: Create regions for AL dataitems and columns”.
After executing the command your DataItems and Columns are “wrapped” in regions. This has the advantage that you can expand and collapse your DataItems and Columns as you like. The more complex the report, the more useful this command is.
That was it for this time. If you can think of any other tips, please comment. The more I can learn, the better 🙂