Custom Report Layout is beautiful functionality given by Business Central. We have used the same report ID of Sales Invoice and created 6 different formats of Sales Invoices for 6 countries :), Based on the company it will display to the corresponding layout only.
Hi Eric, Great video and tried to change the standard Sales Invoice by changing trigger after creating a copy; trigger OnInitReport() var RLS: Record "Report Layout Selection";//*select custom layout custom begin //custom code Layout.Setrange("Report ID", 61306);//Layout declared as a variable at the end of this page if page.RunModal(61306, Layout) = action::LookupOK then RLS.SetTempLayoutSelected(Layout.Code) else Error('Please select layout'); only thing is once the you select the layout from the new page "Select Layout" it goes to the standard request page and then when run the report (preview) it goes back to "Select Layout" page again and then when selected (for the second time) , report exports to PDF
I'm just starting my journey of learning development in AL. I would be tempted to copy the original request page and add a section there which lists the available layouts for the user to select plus the ability to make a new one. Great video as always!
You cannot do that, the layout is selected/fixed when then request page is shown. That's why it has to be done at OnInitReport() - That's the last chance.
Thanks Eric. Great Video. I tried using one report with multiple layouts like you did, however for some reason after running the report it showed me the layout but it also changed all the layouts of standard reports.
Hey Erik! Thanks for this video. That helped. One thing - this method involves manually uploading layouts in "custom layouts" each time you want to modify layout. We are using "rendering" section inside report extensions to import different layouts. My question is - is it possible to choose which report to run by uploading them this way? Inside Report Extension it looks like this: rendering { layout("My Sales Order Confirmation") { Type = RDLC; LayoutFile = 'My Sales Order Confirmation.rdl'; } layout("My Sales Order Confirmation Email Text") { Type = Word; LayoutFile = 'My Sales Order Confirmation Email Text.docx'; } layout("My Sales Draft Invoice") { Type = RDLC; LayoutFile = 'My Sales Draft Invoice (for Sales Order).rdl'; } }
Be aware, that this video was recorded before reportextensions existed, and before BC could do layout selected with the rendering section .... Making this video obsolete :)
Layout is one of the easiest part if customer asks for changes. The main issue for customers is change of logic and grabbing fields from other tables (or even from existing if they weren't added to dataset). I hope MS provide some good looking Report Extension (they promised for next global BC release afair).
Yeah, but until we see something like reportextension, you have to use the substitute report functionality as seen here: ruclips.net/video/qleSGJQD148/видео.html
Eric, my video studio does not show the AL File Wizard. Do I have to install anything to get that to work? I have run AL!Go already. Thanks in advance.
Hi Erik, thank you for the useful videos. Is it possible to reduce the image size from your video? Sometimes I can't see so well the Problems notification area on VS Code. Thanks
Hi Erik thank you for your videos. I started Coding with AL 2 month ago and you are of great help. But saddly i have one problem with this solution right now. If I have set the SaveValues property in the request page to true it will run through the OnInit trigger again when clicking preview and open the Selection page again and then does not give me a proper preview of the report, but instead downloads a file with no doctype. I have set the SaveValues so the requestpage does not close when previeweing the document. Is there a solution to this problem? Should i use a global trigger instead of the onint (Like SelectReportLayoutCode)?
Hi Erik, is it possible to make sub reports in a rdlc layouts for BC? Did you already made a video about that? I did't find it... In the ReportBuilder you can add a sub report but it ask for a URL to a given report.... (???)
Thanks for the video! Is there any efficient way i can make a page action run a standard report - f.ex. the standard sales order confirmation with a specific layout? In that case i can not modify the init trigger in the report. Or is the only way i can do that by duplicating the report?
Custom Report Layout is beautiful functionality given by Business Central.
We have used the same report ID of Sales Invoice and created 6 different formats of Sales Invoices for 6 countries :), Based on the company it will display to the corresponding layout only.
Thank you, Erik.
Microsoft should make your solution as part of the standard report object.
This is a video i'd like to thumbs up a hundred times if i could!
Hi Eric, Great video and tried to change the standard Sales Invoice by changing trigger after creating a copy;
trigger OnInitReport()
var
RLS: Record "Report Layout Selection";//*select custom layout custom
begin
//custom code
Layout.Setrange("Report ID", 61306);//Layout declared as a variable at the end of this page
if page.RunModal(61306, Layout) = action::LookupOK then
RLS.SetTempLayoutSelected(Layout.Code)
else
Error('Please select layout');
only thing is once the you select the layout from the new page "Select Layout" it goes to the standard request page and then when run the report (preview) it goes back to "Select Layout" page again and then when selected (for the second time) , report exports to PDF
You should be able to control that in a global variable.
Erik Hougaard Hi Erik , would you please tell me how can we do that with global variable?
I'm just starting my journey of learning development in AL. I would be tempted to copy the original request page and add a section there which lists the available layouts for the user to select plus the ability to make a new one.
Great video as always!
You cannot do that, the layout is selected/fixed when then request page is shown. That's why it has to be done at OnInitReport() - That's the last chance.
Thanks Eric. Great Video. I tried using one report with multiple layouts like you did, however for some reason after running the report it showed me the layout but it also changed all the layouts of standard reports.
Really?
@@Hougaard Yes. But the solution was to do settemplayoutseletced('') after executing the report and all back to normal.
Hey Erik! Thanks for this video. That helped. One thing - this method involves manually uploading layouts in "custom layouts" each time you want to modify layout. We are using "rendering" section inside report extensions to import different layouts. My question is - is it possible to choose which report to run by uploading them this way? Inside Report Extension it looks like this:
rendering
{
layout("My Sales Order Confirmation")
{
Type = RDLC;
LayoutFile = 'My Sales Order Confirmation.rdl';
}
layout("My Sales Order Confirmation Email Text")
{
Type = Word;
LayoutFile = 'My Sales Order Confirmation Email Text.docx';
}
layout("My Sales Draft Invoice")
{
Type = RDLC;
LayoutFile = 'My Sales Draft Invoice (for Sales Order).rdl';
}
}
Be aware, that this video was recorded before reportextensions existed, and before BC could do layout selected with the rendering section .... Making this video obsolete :)
Layout is one of the easiest part if customer asks for changes.
The main issue for customers is change of logic and grabbing fields from other tables (or even from existing if they weren't added to dataset).
I hope MS provide some good looking Report Extension (they promised for next global BC release afair).
Yeah, but until we see something like reportextension, you have to use the substitute report functionality as seen here: ruclips.net/video/qleSGJQD148/видео.html
Great video. Very clear !
As a beginner, from which video I should start to learn ? is there any playlist for beginners. thank you
ruclips.net/p/PLnldREWlGR0vmyMwB5lmqWjK9KBMwn05s
Awsome tutorial Erik!
Thank you Erik for this trick
Nice tutorial. Do you know how to change the report layout programmatically which is from "Report Layout List" table?
Thanks
ReportLayoutSelection.SetTempLayoutSelected(LayoutCode);
Eric, my video studio does not show the AL File Wizard. Do I have to install anything to get that to work? I have run AL!Go already. Thanks in advance.
Did you install the AZ AL extension in VS Code?
Hi Erik, thank you for the useful videos. Is it possible to reduce the image size from your video? Sometimes I can't see so well the Problems notification area on VS Code. Thanks
can you please do the report amount in words for multiple currencies without hardcoding
please
Hi Erik thank you for your videos. I started Coding with AL 2 month ago and you are of great help.
But saddly i have one problem with this solution right now.
If I have set the SaveValues property in the request page to true it will run through the OnInit trigger again when clicking preview and open the Selection page again and then does not give me a proper preview of the report, but instead downloads a file with no doctype.
I have set the SaveValues so the requestpage does not close when previeweing the document.
Is there a solution to this problem? Should i use a global trigger instead of the onint (Like SelectReportLayoutCode)?
This solution has actually being adopted by Microsoft, so in version 21 you can select a layout out of the box.
Hi Erik, is it possible to make sub reports in a rdlc layouts for BC? Did you already made a video about that? I did't find it... In the ReportBuilder you can add a sub report but it ask for a URL to a given report.... (???)
Sorry, I don't think that's possible :(
Thanks for the video!
Is there any efficient way i can make a page action run a standard report - f.ex. the standard sales order confirmation with a specific layout? In that case i can not modify the init trigger in the report. Or is the only way i can do that by duplicating the report?
you can set the layout before calling the report.
amazing tutorial
Dear Erik, can i preview the report without using run request page??
Not that I'm aware of ...
Hi Eric,
Can i directly call this custom layout using an action button?
Yes you can! Return.Run works fine with this report...
👍👍👍 Thanks
Welcome 👍
Great