web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Change report title caption dynamically

(5) ShareShare
ReportReport
Posted on by 90
I have one report running on the same table. I want to change its caption based on the action I click on the page. If I click 1, the action should show the caption as A. If I click on action 2, it should be captioned as B.

Thanks in Advance
I have the same question (0)
  • Suggested answer
    DAnny3211 Profile Picture
    11,397 on at

    Hi SabzZaman,

    To dynamically change the report title caption in Dynamics 365 Business Central based on the action clicked, you can follow this approach:

    1. Pass a Parameter to the Report:

      • Modify the report to accept a Text variable (e.g., ReportTitle) as a parameter.
      • This variable will hold the caption value (e.g., "A" or "B").
    2. Set the Parameter from the Page Action:

      • In the page extension, define two actions (Action 1 and Action 2).
      • In each action’s trigger, call the report and pass the appropriate caption value.

      Example:

    trigger OnAction()
    var
        ReportParameters: ReportRequest;
    begin
        ReportParameters.SetParameter('ReportTitle', 'A'); // or 'B'
        Report.Run(ReportID, ReportParameters);
    end;
     
    1. Use the Parameter in the Report Layout:

      • In the RDLC or Word layout, bind the ReportTitle variable to the title field.
      • This will display the correct caption based on the action clicked.

    Let me know if you'd like help implementing this in AL or customizing the layout!

    Best regards,
    Daniele

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at
    Unfortunately, I don't think it is possible to change the Report Caption, we have this ability on the page but not on the reports.
  • Suggested answer
    RockwithNav Profile Picture
    8,600 Super User 2025 Season 2 on at
    I never tried this, just check if Report Caption entertains a variable, if it does we can or else we cannot.
     
  • Suggested answer
    Dhiren Nagar Profile Picture
    354 on at
    Hi, In AL Code while developing report you can only set the report caption as a string. Even Text variable is not allowed.
     
    So it is not possible to change the caption of the report dynamically.
     
    However as a workaround what you can do it to create 2 reports with different caption. It will consume one additional object of the report type.
    Finally you can link both the reports separately to the actions on the page you mentioned. Action 1 - Attach to Report with Caption A and action 2 - attach to report with caption B.
     
    This is not inherent solution but a workaround.
     
    I hope this helps.
     
    Regards,
    Dhiren.
  • Suggested answer
    Dynamics_Decoded_Gokul Profile Picture
    451 on at
    Hi, 

    I don't think we can do this with standard reports, But if the report is customized we can try out this approach 
     
    report 50100 "My Report"
    {
        UsageCategory = ReportsAndAnalysis;
        ApplicationArea = All;
        Caption = 'Default Caption'; // Fallback caption
        var
            DynamicCaption: Text[100];
        procedure SetReportCaption(NewCaption: Text[100])
        begin
            DynamicCaption := NewCaption;
        end;
        trigger OnInitReport()
        begin
            if DynamicCaption <> '' then
                CurrReport.Caption := DynamicCaption;
        end;
        dataset
        {
            dataitem(MyTable; "My Table")
            {
                // Columns here
            }
        }
    }



    Enable this as answered if it solves your request. 
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at
    @Tech_BC_Gokul, your suggested code is not possible, there is no property or method available on the report to set the caption.
  • Suggested answer
    YUN ZHU Profile Picture
    95,331 Super User 2025 Season 2 on at
    If it's a field caption, it can be made dynamic.
    As far as I know, it's not currently possible for page captions.
    More details: How to change field captions dynamically in Dynamics 365 Business Central
     
    So your solution is to create two reports with different captions, and then run different reports based on the conditions.
     
    Hope this helps.
    Thanks.
    ZHU
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,136 Super User 2025 Season 2 on at
    You can achieve this by passing a variable into the report through Report.Run or Report.RunModal from your action, then use that variable in the report to set the title dynamically (e.g., in OnPreReport or with a label/field bound to it). Essentially, your page action decides the caption, and the report picks it up.
     
    ✅ Mark this as the verified answer if helpful.
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans