EDIT 20180403: Apologies! I noticed an error in the context I tried to provide for my question background and have corrected it below.
My full "working" card_link syntax should read:
,apex_util.prepare_url('f?p='||:APP_ID||':2:'||:APP_SESSION||'::::P2_DISTRICTID:'||psc.district_id) card_link
The "limited" example below applies ONLY to the initial test to assure the link would direct to the correct page. This example is what is passing the actual URL parameters.
Apologies!
As always I have spend some time searching "Oracle APEX 5 url parameter" in both Google as well as these specific Oracle pages. I have found some very good descriptions of the APEX url structure however I am not finding an answer to this particular question. However I am always glad to be redirected to any source I may have overlooked or misunderstood.
How should I configure a Classic-Report region to use a url parameter passed from a prior page to limit the record results?
I have looked (and worked through) the APEX 5 Advanced Demo in approaching this and the [Automatic Row Processing] on P_3 is very close to what I think I am trying to achieve, however the difference between the single-row return in that example and my attempt to return a "full" report may be keeping me from understanding that more clearly.
Context:
I have a Classic-Report on P_1 of my application configured as "Address Cards" using the t-Card CSS class from the APEX templates.
The SQL supplying the address data crosses 4 joins and includes a group-by clause to provide some counting details to the data-display.
SELECT psc.district_id dist_id
,COUNT(psc.district_id) ps_counts
,dstct.dist_name dist_name
,adds.street_add_1 dist_add01
,adds.street_add_2 dist_add02
,adds.city dist_city
,states.alpha_code dist_state
,adds.zip_code dist_zip
FROM project_sites psc
INNER JOIN districts dstct ON psc.district_id = distct.id
INNER JOIN address adds ON dstct.id = adds.district_id
INNER JOIN states states ON adds.state_id = states.id
GROUP BY psc.district_id
,dstct.dist_name
,adds.street_add_1
,adds.street_add_2
,adds.city
,states.alpha_code
,adds.zip_code
ORDER BY psc.district_id
I have a 2nd Classic-Report on P_2 that I would like to link to an individual card "click" so that the P_2 results are limited by the "District_ID" parameter passed from P_1.
I think the SQL I am trying to execute would ultimately look like:
SELECT psc.id siteid
,psc.district_id districtid
FROM project_sites psc
WHERE ps.district_id = P2_DISTRICTID
;
For the time being however, my current P_2 SQL reads:
SELECT psc.id siteid
,psc.district_id districtid
FROM project_sites psc
/*WHERE ps.district_id = P2_DISTRICTID*/
;
I have added the #CARD_LINK# detail to my P_1 SQL Source and can successfully link the "basic" card-click and move the user to P_2.
Working Link:
, apex_util.prepare_url('f?p='||:APP_ID||':2:'||:APP_SESSION||':::::') card_link
That SQL line successfully loads the anchor tag into the card template and the following can be seen in the run-time env:
http://localhost:8080/apex/f?p=110:2:16604254655568::::P_DISTRICTID:14
However when I update P_2 to look for the DISTRICTID:
(which does validate successfully in the P_2 SQL Source editor)
SELECT psc.id siteid
,psc.district_id districtid
FROM project_sites psc
WHERE ps.district_id = :P2_DISTRICTID
;
The P_2 page load breaks and returns:
ERR-1002 Unable to find item ID for item "P2_DISTRICTID" in application "110".
I suspect I do not have the correct configuration in P_2 to enable the page to load the DISTRICTID parameter to a page object the query can employ.I am torn if my knowledge gap is jQuery, PL/SQL or a combination.
Thanks in advance for all input and suggestions.
Message was edited by: manningda
Corrected an error in the prepare_url examples in my question.