Overview

This document is about how to display collapsible region title based on number of rows returned in an interactive report in oracle apex.

Technologies and Tools Used

The following technologies have been used to to display collapsible region title based on number of rows returned in an interactive report in oracle apex

  • Oracle Apex

Use Case

Let us have the requirement on how to display collapsible region title based on number of rows returned in an interactive report in oracle apex.

Steps with Screenshot

Step 1:  Create a Date Picker Page item and record the values of the parameters. Anything you want can be one of these..

Make an interactive report for yourself. Put it in your collapsible region as a subregion. Make advantage of these arguments in your IR query

 

Step 2: Only activate the report in the presence of parameters.

Create the “SEARCH_ON” hidden page item field.

On your page, Create search button with two dynamic events: search and don’t search.

The following JS expression condition will apply to searches.

Create True Action – Set value will set “P17_SEARCH_ON” to “Y”, then refresh the IR region.

Make sure that your IR query accounts for the “SEARCH_ON” parameter.

“…where :P17_SEARCH_ON = ‘Y’….”

The JS expression requirement for don’t search is as follows.

 

You can do something like display an alert.

Step 3:  Execute the report

With the “Search actions” mentioned above, this would have already been completed.

Depending on how quickly your query runs, it can take a few seconds to complete the background process.

It’s vital to note that the next step counts the amount of rows, so you should define a primary report in your application that shows every row. Otherwise, you might only ever receive 15 rows.

 

Step 4:  Count the rows and dynamically set the title of its host collapsible region

Now you want to remove the title of your collapsible region. Create a hidden Item to store your total in.

Then pick a column in your report that will be display. I chose “Quantity”.

Now create a DA “After refresh” of IR report. It will have 2 actions.

 

The first action will execute JS Code:

$s(‘P17_STOCK_DESPATCHED’, $(‘.a-IRR-table td[headers=”Quantity”]’).length);

Now set the static ID for your collapsable region.

 

Your second action will execute JS Code:

 $(‘#stockdespatched .t-Region-title’).text(‘Stock Despatched (‘+  apex.item( “P17_STOCK_DESPATCHED” ).getValue() + “)”)

There you go! Your collapsible region will show the number of rows in it’s sub-region interactive report.

Output:

Conclusion:

This is all about how to display collapsible region title based on numbers of rows returned in an interactive report which helps end users to view total amount of data in the collapsible region as a badge.

Recent Posts

Start typing and press Enter to search