If I have a report with two defined custom reports, how can I choose one of this layouts before printing the report? I wnat to to that by C/SIDE. Is it possible?
Hi @Roger , There is an event before the report selection that allow you to personalize the business logic: you could check for a field on order (i.e.) and select the Custom Report Layout before the report selection. This should help you.
Hi Michael,
No, the way in Robys answer was not that was i have needed. But in BC140, there a a new event who solved exactly what i want.
Codeunit 951 "Document Report Mgt." has the event OnAfterGetCustomLayoutCode. With this event i was able to change the custom layout, which user can choose on an page who i have provided for that, like this:
LOCAL [EventSubscriber] OnAfterSetCustomLayoutCode(ReportID : Integer;VAR CustomLayoutCode : Code[20])
IF SelectionHeader.GET(PrintCode) THEN BEGIN
IF SelectionHeader."To Thank Letter Rep. Lay. Code" <> '' THEN BEGIN
CustomLayoutCode := SelectionHeader."To Thank Letter Rep. Lay. Code";
END;
END;
May it could be a solution to implement your own publisher event "OnAfterSetCustomLayoutCode" in codeuint 9651. Then you'll have the same possibility as in BC.
Comments
There is an event before the report selection that allow you to personalize the business logic: you could check for a field on order (i.e.) and select the Custom Report Layout before the report selection.
This should help you.
Have a nice day,
Roby
Thanks for answer, i'll check that
Can you say me if the Roger answer helped you and if so can you explain in details how it works ?
Thanks in advance.
Michael
Can you say me if the Roby answer helped you and if so can you explain in details how it works ?
Thanks in advance.
Michael
No, the way in Robys answer was not that was i have needed. But in BC140, there a a new event who solved exactly what i want.
Codeunit 951 "Document Report Mgt." has the event OnAfterGetCustomLayoutCode. With this event i was able to change the custom layout, which user can choose on an page who i have provided for that, like this:
LOCAL [EventSubscriber] OnAfterSetCustomLayoutCode(ReportID : Integer;VAR CustomLayoutCode : Code[20])
IF SelectionHeader.GET(PrintCode) THEN BEGIN
IF SelectionHeader."To Thank Letter Rep. Lay. Code" <> '' THEN BEGIN
CustomLayoutCode := SelectionHeader."To Thank Letter Rep. Lay. Code";
END;
END;
Hope, this helps
Unfortunately I work on NAV 2017 and not on BC, I think that I will create two different reports in place of two layout.
Thanks for your reply and your help/
Michael
May it could be a solution to implement your own publisher event "OnAfterSetCustomLayoutCode" in codeuint 9651. Then you'll have the same possibility as in BC.
Roger
Thanks again,
Michael
As I remember it’s called something like SetTempLayoutCode.
Remember to set it back with a blank Code afterwards.