FlexReport Select report at run time

Posted by: kbj on 28 January 2021, 4:45 am EST

  • Posted 28 January 2021, 4:45 am EST

    I have a FlexReport .NET component named fr loaded into a form with a FlexReport file loaded into it that contains two different reports rpSales and rpExpenses. I wish to be able to select which report to display in the FlexViewer fv. How do I accomplish this?

    Also, Editing a flex report by clicking on the report in the file manager or after right clicking the on-form component and selecting Edit Report... loads the FlexReportDesigner with the last report edited, not the flxr file clicked or the report loaded into the .NET component. I believe I pointed this out years ago, but it hasn't been fixed.
  • Replied 28 January 2021, 5:55 pm EST


    You can accomplish this using some custom code, you can add a combo box to the ribbon of FlexViewer to give the option to choose from the reports available in a file. You can use the GetReportList() method of the C1FlexReport to get all the reports available and add them in the combo box and then you can use the SelectedIndexChanged event of the Combobox to change the report shown in the FlexViewer according to the selected report in the combo box. Please refer to the sample and GIF attached showing the same.

    If you don't want the last file to reload in designer, you need to uncheck the "Reload last file on startup" option in the designer options dialog box. Then the file that you clicked on, will open in the designer. We recommend you check with v4.5.2 of the designer if the issue still exists please let us know. We have attached a GIF showing the behavior at our end.

    Attachment Link:

    Prabhat Sharma.
  • Replied 28 January 2021, 5:56 pm EST


  • Replied 29 January 2021, 1:46 am EST

    Hi Prabhat,
    The idea is to load a report viewer from an flexreport object that is in the form, embedded in the application, not loaded from a file outside the application as in your example. I know there are other solutions, I could embed the report as a resource and stream it in. It just seems that a simple enhancement would be to have a method like:
    fr.SetCurrentReport ("rpExpenses") and then fv.documentsource=fr rather than reLoading the file.

    Thanks for the info on Reload last file on startup. Wouldn't it make sense to have that overridden when the user activates the designer when clicking on a flxr file or using the drop down menu on the control?
    Thanks for your quick response.
  • Replied 31 January 2021, 8:59 pm EST

    We have escalated your requests to the developers and will let you know when we have an update.
    [Internal Tracking Ids: 24289,24290]

    Prabhat Sharma.
  • Replied 27 April 2021, 10:56 pm EST


    You need to re-associate the .flxr extension from C:\Program Files (x86)\ComponentOne\Apps\v4.0\C1FlexReportDesigner.4.exe to one of 4.5.2 C1FlexReportDesigner applications, e.g. to "c:\Program Files (x86)\ComponentOne\Apps\v4.5.2\C1FlexReportDesigner32.4.5.2.exe" to open the clicked report file when a file is clicked.

    Prabhat Sharma.
Need extra support?

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

Learn More

Forum Channels