Friday, August 03, 2007

Oracle APEX: f?p, p?n, z?p

Did you already see: "f?p=", "p?n=", "z?p_url=" in the url's used by Oracle Application Express?

Doing presentations is a good exercise to keep you fresh... You have to write down what you *think* you know ;-)

While preparing some other presentations I wanted to explain the url's in APEX... Although we use the url's all the time, it was more difficult for me to write down what they were doing, so I thought to blog about it.


** The "f" procedure is widely known and well covered in the Oracle APEX User Guide.

It's used to create links between pages in your application using the following syntax:
f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly

(We even included this syntax on our very cool AE MouseMats! I'll post a screenshot of the real mousemat in the next days...)



** The "p" procedure you can use to download a file from the APEX repository (see the apex_application_files view for a list of your files).

For ex. http://apex.shellprompt.net/pls/apex/p?n=217605020644166778 will show you a nice picture that's stored in my APEX repository. (n is the id of the file)

This procedure is not wrapped, so you can see what it's doing:


procedure FLOWS_030000.p (
n in varchar2 default null,
p_mime_type in varchar2 default null,
p_inline in varchar2 default 'NO')

-- Copyright (c) Oracle Corporation 2001. All Rights Reserved.
--
-- DESCRIPTION
-- View a page given a page ID
--
-- SECURITY
-- Public shortcut
--
-- NOTES
--
-- EXAMPLES:
--

is
begin
if n is null then
htp.p(wwv_flow_lang.system_message('p.valid_page_err'));
return;
end if;
--
wwv_flow_file_mgr.get_file (
p_id => n,
p_mime_type => p_mime_type,
p_inline => p_inline);
end p;
/


** The "z" procedure you use to track when users click on external links.

I don't know how I knew about the existence of the Z procedure, but when I discussed with John Scott he told me it had something to do with going to a url via the CountClicks procedure. After searching a bit more on the internet I found some info in the forum and a Tip in the HTMLDB Studio (rip) from Scott Spendolini.

The explanation:
p_url: This is the link to the external site or file to be downloaded.
p_cat: Provide a name that you can associate to this link.
p_company: This is your application's Security Group ID. You can determine what that is by running your app and clicking on "Session" in the developer toolbar at the bottom of the page. The Value for Security Group ID is what you would use in your link. (I didn't found that in APEX 3.0)

Track what users are clicking by navigating to: Home -> Administration -> Monitor -> Top External Clicks

Testing this out with my image of the p procedure: http://apex.shellprompt.net/pls/apex/z?p_url=dgielis.download_filez?p_id=217605020644166778&p_cat=ae_pics&p_company=54352117549007872

If you've some other additions, feel free to comment on this post.

2 comments:

Patrick Wolf said...

Hi Dimitri,

Flavio has done recently a posting about the Z procedure and the counting of clicks which contains some additional infos like the dictionary views you can use to query, ... see Different ways of counting clicks in Apex 3.0

Patrick

Dimitri Gielis said...

Thanks Patrick.

And good work to Flavio!

Dimitri