Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Help: Request Page var value not being set in report

Posted on by 24
Hello all,
I hope somebody can help. 
I'm relatively new to AL, and just trying to do something I thought would be simple but seems BC is doing everything it can to fight against me for it.
So what I want to do is this:
In the Customer Statement Request page I'd like to put a boolean selection for /Show Header/, and this option allows the report to adjust whether or not to print the company details at the top of the page or not. Basically we have headed paper that already has this information on, so it doesn't need to be printed, but if we send by email we do want it shown.
I can put the selection switch in the request page no problem, however no matter what I try it seems the value of this selection does not get /sent/ to the report. I have the field available in the report, but the value is just empty.

Code below:
reportextension #### 'My Standard Statement' extends 'Standard Statement'
{    
    RDLCLayout = './layouts/MyStatementLayout.rdlc';
    dataset    
    {
        add(OverdueVisible)
        {
            column(ShowEmailHeader; ShowEmailHeader) { }
        }
    }
    requestpage
    {
        layout
        {
            addfirst('Output Options')
            {
                field(ShowEmailHeader; ShowEmailHeader)
                {
                    ApplicationArea = All;
                    Caption = 'Show Header?';
                    ToolTip = 'Select to show company details in the header, print header does not need this.';
                }
            }
        }
        trigger OnOpenPage()
        begin
            ShowEmailHeader := false;
        end;
    }
    var
        ShowEmailHeader: Boolean;
}
 
[Please note I've replaced some double quotes with single quotes because for some reason this forum can't escape double quotes properly... whwwwwhhhhaaaat!?!?!]
 
The OnOpenPage() trigger allows me to set the default state of the ShowEmailHeader value, but still that value doesn't get passed to the actual report.
I've also tried with a different type of field, a text field, but even then the text doesn't get passed to the report, even though the field is available in the report.

If anyone can answer why that would be great!!
  • Verified answer
    Community member Profile Picture
    Community member 24 on at
    Help: Request Page var value not being set in report
    Right.... it seems by moving the column declaration from    add(OverdueVisible) to    add(Integer) this has worked
     
    Bonkers!
  • Community member Profile Picture
    Community member 24 on at
    Help: Request Page var value not being set in report
    This is such a weird problem.
    So, as Yun Zhu suggested, setting a value on the OnPreReport trigger also does nothing - in the report, the value of that variable is empty - not even True/False/Yes/No, just empty.
    If I put a Message box to display the set value in the OnPreReport trigger though, I can see the value that's set. It's just that value isn't making its way to the report.
     
    I've tried with a simple text variable as well - nothing!
     
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 71,565 Super User 2024 Season 2 on at
    Help: Request Page var value not being set in report
    Hi, If the value is only displayed once(Only on the header?), try the following assignment in OnPreReport trigger or OnPostReport trigger
    ShowEmailHeader := false;
     
     
    Hope this helps.
    Thanks
    ZHU
  • Community member Profile Picture
    Community member 24 on at
    Help: Request Page var value not being set in report
    Hi Ariba,
     
    Thanks for your response but this does not work - it will not allow me to add that parameter anywhere.
    I believe `RequestFilterFields` parameter can only be set under a `dataitem` block which is not available in a reportextension unless I'm adding or modifying a table of fields - in which it then shows fields of that table to be filters. This isn't what I'm doing unfortunately, and the ShowEmailHeader Filter is already in place anyway.
     
    Thanks though
     
     
     
     
     
  • Ariba Mehdi Profile Picture
    Ariba Mehdi 160 on at
    Help: Request Page var value not being set in report
    Hi Paul,

    Try to use the property RequestFilterFields under dataitem section. 
    ​​​​​​​
    For example: 
    RequestFilterFields = ShowEmailHeader;

    Hope this helps!

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans