locked
Modify source data after report.Refresh() RRS feed

  • Question

  • Hello

    Is it somehow possible to alter the data of a report after Refresh() has been invoked?

    I need to replace a picture on the report before it's being exported. From the original datasource (A stored procedure) I'm just returning a 1x1px dummy-bitmap which I would like to replace from code after the report has been populated with data.

    Wednesday, July 20, 2011 1:11 PM

Answers

  • Hi Vort,

    You can upgrade to CR Xi R2 for free, use your XI keycode to install:

    http://downloads.businessobjects.com/akdlm/crystalreports/crxir2_sp4_full_bld_0-20008684.exe
    http://downloads.businessobjects.com/akdlm/crystalreports/CRYSTALREPORTS06_0-20008684.EXE

    Have a look at these inProc RAS ( Report Application Server ) samples:

    http://wiki.sdn.sap.com/wiki/display/BOBJ/NET+RAS+SDK+Samples#NETRASSDKSamples-Exporting%2FPrinting

    Using RAS you can use the SavedDataController which allows you possibly make  changes to the image without hitting the DB again. Although because you wanting to update the signature it may force the report to.... mmmmm Having the signature in the DB should not be a problem as long as the signature is not in a subreport. The query to build the whole report is set once so all sig's are returned from the DB and the report is built. So it's not a problem doing it in a run once mode. Exporting will refresh the data, do not use the Refresh API and check off all of the Verify Database Options in the Report Options menu item and save the report. When you preview the report in the Viewer and select export it should not hit the DB again. To verify though export to RPT format so you have the report with saved data and then use it.

    Data Sets are limited to about 5K rows of data but that changes a lot depending on the info of course, absolute max would be 10K rows for a very simple report.

    If you want though you could use a subreport for the signature and it's data source can be the signature in memory through a DS or possibly based on an XML file, CR has the ability to export or use images in XML file sources.

    Thanks

    Don


    Don Williams
    • Marked as answer by ShaniaTwain Friday, July 22, 2011 6:38 AM
    Thursday, July 21, 2011 2:33 PM

All replies

  • Hi Vort,

    In a round about way there are a few options. Depending on the version you are using you can link the Company Logo to a database field that holds a file path to where the image exists. Or in the DB itself but then it would appear on the report but more on this later.

    The other way is to create your own Print or Export button and on the click event open another report for exporting only that has either the logo embedded in the report or has an updated link to the image, either way will work.

    The third option is to use a full version of Crystal Reports so you have access to RAS ( Report Application Server ). It has RCAPI abilities so you can insert the image at runtime using the same click event on either your print or export button.

    If you upgrade to Visual Studio 2010, not the express version, and then go to SAP's site and download Crystal Reports for VS 2010 plug-in you now have full report functionality ( almost ) and it includes RAS. There are a lot of samples on SAP's WIKI page on how to use RAS for report Creation...

    And the last option I have is to change the field from your dummy bitmap to the company logo field or location. Bu tI'm not sure if that would work, depends on the version of CR you are using.

    Don


    Don Williams
    Wednesday, July 20, 2011 1:33 PM
  • Hi Don and thanks for your answer.

    It's actually a signature that has to be replaced :P
    So, the "swap" has to be dynamic since the signature is determined by who has logged on to the application. Making a report for each user would be very hard to manage.

    I'm using CR XI... Is that the "full version"? (I'm quite new to CR :S )

    Another solution I've tried is to extract the name of the SP invoked by the report and then call this SP manually to fill a dataset. I was hoping that I could set the datasource on the report with report.SetDataSource(the_dataset), but when I call Export the report still pulls data from the database, which it should not.

    Is it possible to force the report to use a custom dataset instead of getting it from the database?


    Edt: The signatures is stored on the same db server as the data populating a report, so I have the option to obtain reportdata+signature from the SP in once call. However, the size of a signature can be a few hundred KB and the number of reports to be exported would often be several hundred. When a user is logging on to the application, the signature for that user is downloaded once and stored in memory, so it would be nice to avoid downloading the same signature again and again for each report.
    Thursday, July 21, 2011 8:10 AM
  • Hi Vort,

    You can upgrade to CR Xi R2 for free, use your XI keycode to install:

    http://downloads.businessobjects.com/akdlm/crystalreports/crxir2_sp4_full_bld_0-20008684.exe
    http://downloads.businessobjects.com/akdlm/crystalreports/CRYSTALREPORTS06_0-20008684.EXE

    Have a look at these inProc RAS ( Report Application Server ) samples:

    http://wiki.sdn.sap.com/wiki/display/BOBJ/NET+RAS+SDK+Samples#NETRASSDKSamples-Exporting%2FPrinting

    Using RAS you can use the SavedDataController which allows you possibly make  changes to the image without hitting the DB again. Although because you wanting to update the signature it may force the report to.... mmmmm Having the signature in the DB should not be a problem as long as the signature is not in a subreport. The query to build the whole report is set once so all sig's are returned from the DB and the report is built. So it's not a problem doing it in a run once mode. Exporting will refresh the data, do not use the Refresh API and check off all of the Verify Database Options in the Report Options menu item and save the report. When you preview the report in the Viewer and select export it should not hit the DB again. To verify though export to RPT format so you have the report with saved data and then use it.

    Data Sets are limited to about 5K rows of data but that changes a lot depending on the info of course, absolute max would be 10K rows for a very simple report.

    If you want though you could use a subreport for the signature and it's data source can be the signature in memory through a DS or possibly based on an XML file, CR has the ability to export or use images in XML file sources.

    Thanks

    Don


    Don Williams
    • Marked as answer by ShaniaTwain Friday, July 22, 2011 6:38 AM
    Thursday, July 21, 2011 2:33 PM
  • Ok thanks, I'll look into RAS. And thanks for the reference to the samples. I havn't tried it yet, but this seems exactly what I'm looking for: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00ab8a66-d166-2b10-b5a5-bed846097392

    Friday, July 22, 2011 6:38 AM