Automatically Navigate to Form from Interactive Report - Oracle APEX

Automatically Navigate to Form from Interactive Report - Oracle APEX

How much is a click worth?

I was recently asked if I could have an APEX form page load automatically when an Interactive Report (IR) resulted in exactly one row returned. I spent about 5 minutes coming up with a solution, followed by about 15 minutes working with Jorge Rimblas to improve my solution.

This assumes you are using an IR with the link built within the IR Attributes. To do this with your own column you need to set a Static ID and use that in place of "LINK" in the code below.

Create a Dynamic Action (DA)

It will be On Refresh of your IR

And it will have the Client-side Condition, Javascript expression

($("td[headers='LINK']").length==1)

Have a True action of Execute Javascript Code

It will have Code

apex.navigation.redirect($("td[headers='LINK'] a").attr("href"));

If the target of the link is a modal window, you may even want to set Fire on Initialization to Yes. If the target is NOT a modal, leave this set to No as you'll have a tough time getting to the report otherwise.