Programmatic generation of History snapshots with varying parameters

When you call CreateReportHistorySnapshot it generates a snapshot of the specified report with only the default parameter values.

How would I generate snapshots based on parameters specified at runtime



Answer this question

Programmatic generation of History snapshots with varying parameters

  • LordWolf

    I think you would be better off using a LinkedReport. This is what they are for. So you can use the basic report yet different parms, Security, folder etc...

    But your way will work to you just have to write a bunch of code to make sure you put it back. Assuming that is necessary.

    Dave



  • rkin005

    Hello,

    A couple of quick questions regarding this:

    1. Do you have to have default values for the parameters on the report

    2. If the report has a paramater called Parameter1, do I create a property with the name Parameter1 to pass into the CreateLinkedReport method

    Thanks in advance...


  • Serovic

    I've done this before using a Linked Report. If you first call CreateLinkedReport() you can pass in the properties for the Report. Then Create a Snapshot of that.

    If that is not enough to get you going let me know I'll see if I can dig up the code.

    Dave



  • geebee

    Thank you Mike!
  • Kevin Lawrence

    1. all parameters have to have defaults in order to create history snapshots -- there's no way to pass a parameters collection into the CreateReportHistorySnapshot method.

    2. When you create a linked report, the new linked report inherits the parameters collection of the parent -- all you have to do then is call Get/SetReportParameters on the new linked report to change its defaults.


  • Forbes.Pu

    Paul,

    Have you found a solution out for this yet I am having the same issue in how to pass a dynamic parameter at runtime.

    Thanks,

    Wayne Larimore

    http://Waynester.Net/Blog


  • Nate Cook

    I have an alternate way of doing it, but I'm not sure if there are any implications to doing it this way which may be harmful.

    I am basically calling SetReportParameters on the report in question and overwriting the default parameters values for that report with the user-supplied values and then immediately calling CreateReportHistorySnapshot. This generates a snapshot but I'm not sure if there might be some side-effect to doing it like this.

    I'm going to extend the code by saving the parameters beforehand and restoring them after the snapshot generation. Would that mitigate any negative side-effects that my approach might introduce


  • Programmatic generation of History snapshots with varying parameters