How do you force a page submit when paginating through a report?
Standard behaviour from apex is to redirect when navigating through the recordset of a report. While this is advisable in most cases, we sometimes need processes to run when the user clicks the next or previous button.
I have often seen the question, but never an answer. Although this can be achieved fairly easy, with following steps.
1) Adapt the report template. Best is to create a new report template, based on an existing template, so we don’t affect all pages.
I copy “Standard Report” and name it “Standard Report with Submit”.
2) In this new template we are interesting in the “Pagination Subtemplate”. We change “Next Page Template”, the original value will be a redirect:
We can easily change this to a submit:
And we change “Previous Page Template” analogous from :
3) When we use this report template on our page, the next and previous button will submit, and the request will be the url it wants to redirect too. This way we can use our ‘after submit’-processes.
4) The last step we need is to foresee a branch.
We create a branch to URL, and our url will be our request:
We make the branche conditional, based on Pl/Sql:
:REQUEST LIKE ‘f?p=%’
Steps 3 & 4 need to be repeated for every page needing this functionality. Our processes can be made conditional in the same manner as our branch.
We used this for saving our data temporarily to a collection when paginating through an updatable report, and we didn’t notice any drawbacks using this method.