Jump to content

Scriptlet and Transactions


gorilla

Recommended Posts

SHORT SUMMARY
Database updates made by a scriptlet are not visible to the report invoking the scriptlet. At least, that's my best shot at a summary based on my experimentation.

FULL EXPLANATION
I have a Master Report that links to a Detail Report. The Detail Report has a scriptlet class associated with it. The sciptlet overrides beforeReportInit().

When the Detail Report is viewed, the scriptlet method beforeReportInit() is invoked and it runs a web service and gets an XML response indicating success. The web service takes a transaction ID as input. If the images for that ID are not already in the image table, they are copied from the source database.

So far, so good.

The Detail Report contains a sub-report. The sub-report displays the images from the image table in the reporting database.

The first time the Detail Report is viewed for a specific transaction ID, the scriptlet runs, the web service is invoked, and I can see the images in the reporting database for that ID.

The problem is that the sub-report does not display the images on the first viewing. The images appear only after a refresh or a subsequent viewing from the Master Report.

It's not a matter of timing. Injecting sleep() calls in various places (web service, scriptlet) made no difference. No amount of waiting allows the sub-report to find the images on the first viewing.

QUESTIONS/SPECULATION
Why don't the images appear on the first viewing of the Detail Report?

Is there a transaction started when the Detail Report is viewed? That might explain why the sub-report SQL finds no records in the image table.

I used beforeReportInit() assuming this would be the earliest possible hook into the Detail Report processing. If there is some transaction-related issue at play, is there a way for a scriptlet method to be invoked before the transaction begins?

Is there a way to invoke a scriptlet method in the Master Report when the hyperlink is clicked, like an onclick on an anchor tag?

Other suggestions for fixes or workarounds?
 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...