Caching SQL Results for Fast Report Export

Hi Team,

We are currently using fast report in .NET 3.1.

The situation is when we are generating a report it generates SQL query and fetched records and rendered in application as preview. Again while trying to export the report as pdf or excel ,the same query is executing from the first step and generating the same result and finally its exporting.

Generally Caching technique is preferred for small memory consuming data, Are any other technique can be used to overcome the above situation?

It would be great help if any thoughts or hits received

Comments

  • Hello!

    To avoid running the SQL query repeatedly when exporting the same report in multiple formats (for example, PDF and Excel):

    Prepare the report once using `report.Prepare()` (the database query will be executed once) and immediately save the prepared document in .fpx format using the `SavePrepared(...)` method (or simply export this same prepared report object consecutively to both exporters — PDFExport and Excel2007Export — without calling Prepare() again).

    report.Prepare(); // 1 database query
    report.SavePrepared(‘cached.fpx’);
    
    using var cached = new Report();
    cached.LoadPrepared(‘cached.fpx’);
    cached.Export(new PDFExport(), ‘out.pdf’);
    cached.Export(new Excel2007Export(), ‘out.xlsx’);
    
This discussion has been closed.