I have a classic report on page 1. I have a region button called "Export" (defined by a submit dynamic action with "show processing=Yes") that submits the page and then via a branch directs me to page 2 which has a slightly different version of the report on page 1 (i.e. no breaks) which I want to capture as a CSV export. Therefore I've set the report template on page 2 to " Export:CSV".
Now when I click on the page 1 export button the grey screen and loading gif appears indicating that the report is executing and then as expected, page 2 doesn't appear but instead the standard open/save window's dialog box appears asking to open or save the generated CSV file. All good..but the grey loading screen remains. How do I clear this loading screen and get back to the context of page 1 ?
thanks in advance
I'm not sure if there is anything you can do. The submit occurs but nothing gets sent back. There is no hook for this. I don't know how you'd check this condition. Wouldn't it be an alternative to not do the loading icon, and open the page with the export in a url with target="_blank" so it doesn't disturb the current screen?
We would love to help but you left out one crucial part of the puzzle: namely how does your CSV report get exported. With the way it is setup (a redirect to another page), I'm going to assume you do that because you have some PL/SQL on that page that prints the CSV.
Now there are two questions that are crucial here:
- How do we stop the icon from bugging us on the screen
- How do we communicate with the browser that it should no longer display the loading icon
The first question is rather easy, two simply lines of codes can do that:
But when do we use this code? Quite simple when the document is downloaded. When is it downloaded? At the end of the PL/SQL code that prints the document to the browser.
What you could do is at the end of that code give an application item a certain value. For example :AI_PRINTED := 'Y';
Better would be a Server send event, but since you left out another crucial piece of information: your browser, I will not go deeper into this.
Start this timing event when someone asks for the document, and end it as soon as the process returns that :AI_PRINTED equals 'Y'.
Despite the lack of information, I hope I have given, or at least inspired you to get to the solution.
Many thanks for your reply. Here are the bits of information your mentioned that were crucial to the puzzle.
1) My browser is IE 9.0.8112 or Firefox 25.0.1
2) To export a report directly to CSV is very simple and there is no need to write any PLSQL. In a normal (classic) report that renders as a visable report you write the SQL and apply an appropriate report tempate but in the case of a report that does not render but immediately prompts you to save the output to CSV format, all you have to do is apply the report template called, " Export:CSV". No code is needed. I have the visible version of the report output on page 1 and the exportable version (slightly different i.e. no breaks) on page 2. Navigating to page 2 immediately brings up the standard open/save window's dialog box asking to open or save the generated CSV file.
It's very simple.
Problem is getting focus back on page 1 and clearing the grey screen and the animated loading gif which were initiated by a Dynamic Action defined button with "Show Processing on Submit" checked.
So the question is, where should I put the code you suggested?: