Monday, March 12, 2012

Report SnapShot Creation Programmatically through Java

Hi,

I am facing some issues while creating report snapshots programmatically using axis (Java platform for creating and deploying web services applications).

To create a report snapshot what should be the methods called ? I tried using UpdateReportExecutionSnapshot() but didn't find any parameters to set the schedule information which would say when the execute the report snapshot. Can you please guide me for this ?

Also I had one more doubt regarding report snapshots. If a parameterized report is configured as snapshot then we would require to set default parameters for the report.

Is there a way to create snapshots of the same report with different parameters ?

eg : The employee information report displays the information based on the employee id taken as a parameter. So is it possible to create snapshots with different employee id's ?

Thanks,

Amit Shah.

For configuring snapshots programmatically you can call SetReportHistoryOptions SOAP API. But for the task as you described you better pre-populate cache using subscriptions with Null Delivery Provider. You can create multiple ordinal subscriptions with different parameter sets or create one data-driven subscription which will iterate through different parameter sets (e.g. users) via query. Then configure report execution options to allow rendering the report from the cache. See: http://msdn2.microsoft.com/en-us/library/ms155927.aspx and http://msdn2.microsoft.com/en-us/library/ms155876.aspx

|||

Thanks for the replies.

I tried create a report snapshots and saving it in the report history by using the CreateReportHistorySnapshot() method call, but facing some issues with it.

The report being used to create the snapshot is a parameterized report. Hence before calling CreateReportHistorySnapshot() I call setReportParameters(). I pseudo code is something like this :

for( int i=0; i<10; i++) {

reportSnapshot.setParameters(parameterValue)

reportSnapshot.createReportHistorySnapShot().

}

But when I check the report History it has only 4 snapshots created (instead of 10). I confirmed that the report parameters are set properly by calling getReportParameters().

One more important point is that the last report was not having the latest parameter values passed i.e the snapshot was not having the values which are passed during the 10th iteration. It was having values passed during the 7th iteration(this was also not consistent).

Can anyone please guide me.

Thanks in advance.

|||

I don’t have an explanation why you’re missing some reports in the history snapshots. Analyze warnings returned by this API and log file. But history snapshots are not used as cached reports anyways. I would advise exploring Null Delivery Provider for pre-populating the cache as I pointed in my previous reply.

-Igor|||Just to add to my previous posting. The likely reason you are missing some reports in the history is the following. By design RS keeps unique index on ReportID+SnapshotCreateDate in History table, and timestamp’s granularity is in seconds. If report’s default parameters are changed and new snapshot is being created within same second as previously created snapshot, then the last one will be discarded. The bad thing is that RS won’t return an error on CreateReportHistorySnapshot call. This is the known issue.|||

I liked this thread so much, I just blogged about it. Here's the post:

http://blogs.msdn.com/lukaszp/archive/2007/01/12/per-user-snapshots-or-multiple-snapshots-for-a-report-each-with-different-parameters-at-the-same-time.aspx

-Lukasz

|||

Thanks a lot for the replies.

But as you mentioned that :

If report’s default parameters are changed and new snapshot is being created within same second as previously created snapshot, then the last one will be discarded. The bad thing is that RS won’t return an error on CreateReportHistorySnapshot call. This is the known issue.

So if I dont change the parameters or create a snapshot of a report which does not have any parameters, then will more than one snapshots get created in one second ?

I tried this programmatically but the snapshot was not getting created for a parameterless report & also when the reports parameters were not changed. Just wanted to confirm on whether I was doing some thing wrong or it is because of the timestamp's granularity is set in seconds.

Thanks in advance.

|||I believe nothing wrong with your code - it happens because timestamp's granularity is set in seconds.

No comments:

Post a Comment