To start, here's an example of how to modify the download button in IRs. Just some background on this, we're only supporting CSV downloads now. When the clients would download IRs they would have to click the "Download" link then click on the "CSV" button.
We found this extra step unnecessary so here's a way on how to do it in one step so that it will download as soon as they click "Download". We used jQuery to help out a bit. Here's a working example.
$(document).ready(function() {
$('.dhtmlSubMenuN[title="Download"]').attr('href','f?p=' + $v('pFlowId') + ':' + $v('pFlowStepId') + ':' + $v('pInstance') + ':CSV:');
});
Here's a detailed summary of how it works: If you scroll over the "CSV" download button you'll noticed that it looks something like : "f?p=102:3:207941080701500:CSV:". If we break that down it's really: "f?p=
APP_ID = $v('pFlowId');
APP_PAGE_ID = $v('pFlowStepId');
SESSION_ID = $v('pInstance');
Now to alter the "Download" link from the interactive report menu we use jQuery to identify the link: "$('.dhtmlSubMenuN[title="Download"]')" and then use the attr function to set with the new URL.
Hi,
ReplyDeleteThanks a lot for posting this.
Can you please let us know where exactly we should be placing the jQuery and how is it getting invoked?
Thanks
Pooja
Hi,
ReplyDeleteThanks a lot for posting this.
Can you please let us know where exactly we should be placing the $(document).ready(function() {
$('.dhtmlSubMenuN[title="Download"]').attr('href','f?p=' + $v('pFlowId') + ':' + $v('pFlowStepId') + ':' + $v('pInstance') + ':CSV:');
});
If you're using APEX 4.0, create an On Page Load dynamic action of type JavaScript. You can paste the code into the Code section.
ReplyDeleteMartin
Good stuff!
ReplyDeleteThanks so much!! :)
Hi Martin:
ReplyDeleteThis works great when the page is first loaded, but if the report is changed dynamically (e.g., by doing Actions > Select Columns) it reverts back to displaying the Apex download menu. See page 2 (Customers) of:
http://apex.oracle.com/pls/apex/f?p=36721:2
User ID: DEMO
Password: demo
Can you let us know how to fix this?
Gerry
Hi Gerald,
DeleteYou can create an After Refresh Dynamic Action on the report and run the JS to hide the CSV download button.
Martin
Thanks! Works like a charm!
Delete