Change custom report layout by C/SIDE

RogerRoger Member Posts: 57
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?

Thanks for all answers.
Many thanks, Roger

Comments

  • RobyRRobyR Member Posts: 39
    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.

    Have a nice day,
    Roby
  • RogerRoger Member Posts: 57
    Hi Roby,
    Thanks for answer, i'll check that
    Many thanks, Roger
  • mcoscasmcoscas Member Posts: 34
    Hi Roger,
    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
  • mcoscasmcoscas Member Posts: 34
    Hi Roger,
    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
  • RogerRoger Member Posts: 57
    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;

    Hope, this helps
    Many thanks, Roger
  • mcoscasmcoscas Member Posts: 34
    Hi Roger,

    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
  • RogerRoger Member Posts: 57
    Hi 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
    Many thanks, Roger
  • mcoscasmcoscas Member Posts: 34
    Yes I see this codeunit and the function "TryUpdateRdlcLayout". I will try this option.
    Thanks again,
    Michael
  • JuhlJuhl Member Posts: 724
    On 2017 there is a function on TAB77 you call before printing.
    As I remember it’s called something like SetTempLayoutCode.

    Remember to set it back with a blank Code afterwards.
    Follow me on my blog juhl.blog
Sign In or Register to comment.