Prompt for Parameter Value with Viewer

Posted by: mdynna on 4 September 2024, 12:26 pm EST

    • Post Options:
    • Link

    Posted 4 September 2024, 12:26 pm EST

    When building a custom Page Report with a Parameter, when clicking on Preview it prompts the user for a Parameter value to select before running the report. After our users have built a report we want to be able to have them simply run it and display the results in a Viewer control. Is there a way to get the Viewer control (on a Form with the control) to prompt for a Parameter value the way the report Designer does?

  • Posted 5 September 2024, 4:37 am EST - Updated 5 September 2024, 4:42 am EST

    Hi Mark,

    ActiveReports does provide Viewers that support technologies like Blazor, ASP.NET Core, ASP.NET MVC, Angular, React, HTML5/JS, WPF, and WinForms. You may refer to the attached link to know more about them: Report Readers

    Also, please note that if you have a parameter that can’t be null or does not have a default value specified, then it will require the user to enter the parameter value before rendering the report. To overcome that, you can make the parameter accept null values by checking the Allow null values option of the parameter (see NullValues.png). For setting default value of the parameter, you may refer to the attached documentation page: Hidden Parameter. Here you can skip the option of making the parameter Hidden so that you can also change its value via the Viewer as well.

    We hope this helps!

    Attachments:

  • Posted 5 September 2024, 2:03 pm EST - Updated 5 September 2024, 2:09 pm EST

    We are using a WinForms Viewer. When the user is creating a report in the Designer, when they click Preview it will prompt them to fill in the (required) parameter automatically.



    When the same report is displayed in the (WinForms) Viewer control it doesn’t prompt, at least it doesn’t when the Run method is called. Is there a way to get the Viewer control to prompt the user for the Parameter value like the Designer does?

  • Posted 6 September 2024, 12:19 am EST

    Hi Mark,

    We tested with ActiveReports v18.1.1 and could observe the same behavior in both the Designer preview and Winforms Viewer. Both the Designer preview and Winforms Viewer prompted the parameter pane before rendering the report. Please see the attached screenshare video demonstrating the same. If the issue persists, please share with us the following:

    • Exact version of ActiveReports that you are using
    • Steps to replicate the issue
    • Sample report with sample data
    • Screenshare video demonstrating the stated behavior

    Attachments: ParamIssue.zip

  • Posted 6 September 2024, 11:08 am EST

    We’re using Active Reports 17.0.2. With the SectionReports that we use we normally just call Report.Run and then pass Report.Document to the Viewer’s LoadDocument method. Should we be using a different method for the PageReports that have parameters?

  • Posted 9 September 2024, 3:34 am EST

    Hi Mark,

    Please refer to the attached sample where we have loaded a Page Report that contains parameters to the Winforms Viewer. In the report, there are 2 parameters. The first parameter has no value specified, and it is non-nullable, so it will prompt the user to enter it’s value before rendering the report. For the second parameter, we have specified a default value via code.

    Let us know if you still have any issues.

    Attachment: PageReportParameter.zip

  • Posted 9 September 2024, 6:17 pm EST

    Ok, got it. You don’t call Report.Run you just call Viewer.LoadDocument and then it prompts for parameters. Thanks.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels