Dynamically Branching To Pages and Passing Parameters in Application Express
I have a love/hate relationship with frameworks. Once you get proficient with a framework (like Application Express) you can get a lot done quickly. The framework can also stand in your way if you encounter a bug or maybe a gray area where the Framework wasn't fully fleshed out. Sometimes it takes some digging to find a workaround.
In this case I have a simple reporting application that I built in Application Express. I wanted the user to select a report, then continue to a Criteria screen, enter some date ranges and then hit 'Submit' to render the report.
I had created a clickable list of reports that contained a Report Name and Report Page associated with each report.
The list pointed to my Criteria screen and passed the P_TARGET_PAGE variable. All well and good.
The idea is for the Criteria Page to redirect to the P_TARGET_PAGE page and pass along Criteria parameters that were gathered in the screen. My problem came when firing the report from the Criteria screen. There are a couple of options of Branching to Page using the value of a Page Item... But none that would pass along the parameters I had collected in my Criteria screen.
I had to resort to creating my URL from scratch to get what I wanted. I used the "Branch To Function Returning URL" branch in Apex. The code is available here for reference.