1
votes

I have two Main reports. Each report has a corresponding region with a Nonmain Classic report (so 4 reports total). Clicking on a link in each of the Main reports reveals details in its corresponding Nonmain report.

Currently, clicking on a Main report will reload the whole page, and all the PL/SQL and SQL has to refire from all 4 reports.

It would cut down on the SQL calls if only the nonmain report refreshed. I assume AJAX would be the best bet to accomplish this.

How would I go about doing such a task?

Thank you.

P.S., all four reports are determined by a PL/SQL function returning a SQL statement. All headings also are determined by a PL/SQL function returning a colon-delimited string.

2

2 Answers

1
votes

With your previous questions in mind, your classic reports rely on the session state of some page items. You are setting the value of these items in your colunmn links.
If you want to cut out the submit of the page then you need a way for the anchor tags to not fire their default action and provide the value for page items to be set to a dynamic action.

You have to put this in the column link attributes:

onclick="return false;#" class="reportlink1"

You then need to pass on some data, and i suggest using data tags

data-value1="#COL1#:"

Create a dynamic action, firing on click and uses a jQuery selector .reportlink1

What needs to happen now is to provide the page items with their needed values Add a true action to execute javascript:

 var lValue1 = $(this.triggeringElement).data("value1");
 $("P1_ITEM1").val(lValue1)

With the item value set, create another true action of type "Refresh" and set it to affect your secondary report.
The final step is then to set the "Page items to submit" on the secondary report. This will cause the report to submit the values of the set page items to the session and ensures that the sql will return the correct values when the region is refreshed.

1
votes

For some reason, Tom's approach did not work for me; I assume it must be the idiosyncrasies of my page. If anyone stumbles upon this question, try Tom's method first, and if for some reason it doesn't work then try the following adaptation with AJAX in the dynamic action:

If your nonmain reports rely on the session state of some page items, and those items are set via column links from your main report, you must put this in the column link attributes to prevent the submission of the page and to pass the values using data tags:

onclick="return false;" class="reportlink1" data-value1="#COL01#" data-value2="#COL02#"

Create a dynamic action, firing on click and using a JQuery selector .reportlink1

Provide the page items with their needed values VIA AJAX. Add a true action to execute synchronous javascript:

 var v1 = $(this.triggeringElement).data("value1");
 var v2 = $(this.triggeringElement).data("value2");
 var get = new htmldb_Get(null, &APP_ID., 'APPLICATION_PROCESS=dummy', &APP_PAGE_ID.);
 get.add('PX_ITEM1' , v1)
 get.add('PX_ITEM2', v2);
 gReturn = get.get();
 get = null;

With the item values set, create another true action of type "Refresh" and set it to affect the secondary report.

Unlike Tom's solution, DO NOT set the Page Items to Submit on the secondary report.