This is a migrated thread and some comments may be shown as answers.

How to save and view report snapshot

1 Answer 120 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 21 Oct 2019, 10:30 PM

I have an invoicing app that loads data from various sources and shows a balancing report that compares costs, etc...  Once the invoice is balanced and ready to be paid, it is set to approved status.  The problem is that sometimes invoice balancing reports need to be viewed later after processing, and some data may have changed in the interim.  So I would like to snapshot the invoice report when an invoice is set to approved status.

I have found solutions for rendering a report to pdf - those are easy enough to implement, but every request for how to view pdfs with the telerik ReportViewer control has been answered with "it's not supported, and we won't consider supporting it."  So I can export the report to pdf when then invoice is approved, but I have no way to display it to the user.  I could just open up the system pdf viewer, but that creates a weird disjointed experience - if the user selects 5 invoices to view reports and 3 of them are Approved and 2 are Pending, the pending ones will be displayed as part of the same ReportBook in the Winforms ReportViewer, but the other 3 would have to be opened in a separate window with Adobe Reader.  What I really want is to create an Invoice.GetReport() function that returns a ReportSource that encapsulates either a Report to be generated or a saved "frozen" report with the details that existed when the invoice was approved.

Is there any way at all to save a Rendered report (in any format - it doesn't have to be pdf) and then view it at a later time within the same user interface that I am using to display live reports?

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 24 Oct 2019, 12:29 PM

Hello Chris,

Telerik Report Viewers can display only Telerik Reports generated by our Reporting engine. They are not designed to display ready documents. Generally, when a report is requested to be displayed or refreshed in the viewer, it will be generated anew exactly for the reason that the data may have changed.

If you want to be able to display a report with older data, you need to preserve the old data, and when necessary to generate the report with this preserved old data. For example, you may implement an ObjectDataSource and use a Report Parameter value as an argument passed to the data member of the ObjectDataSource. Based on the argument value the logic of the data member should decide whether to fetch the fresh data or use old cached data, e.g. when the old-data report was created.

Another approach is an ObjectDataSource with two data members. One data member method to return the real data freshly fetched from the database. The other method may be used to provide data cached from a previous call to the database. Then you may use a dedicated Report Parameter, which value to indicate which data member to be used to extract the data for the report. For this purpose, you may use the approach described in the Change Connection String dynamically through a report parameter KB article. Instead of 'DataSource.ConnectionString' you should use (type manually) 'DataSource.DataMember' and specify the name of the method.

Regards,
Todor
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Chris
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or