Thursday, December 3, 2009

APEX: Substitution Strings

Home --> Workspace --> Application Builder --> Substitution Strings

I was asked a question the other day about substitution strings. Like many things, I did not know all of them off the top of my head. But I do know where to find them.

A trick I used to use was to create a page with an HTML Region and put all the substitution strings in there...just so I could remember them.

In an HTML Region, the syntax is
&<substitution_string>.
Here's the list of all the substitution strings supplied by APEX in 3.2.1.00.11 (just cut and paste this into your Region Source):
<b>APP_ALIAS</b>: &APP_ALIAS.<br>
<b>APP_ID</b>: &APP_ID.<br>
<b>APP_IMAGES</b>: &APP_IMAGES.<br>
<b>APP_PAGE_ID</b>: &APP_PAGE_ID.<br>
<b>APP_SESSION</b>: &APP_SESSION.<br>
<b>APP_UNIQUE_PAGE_ID</b>: &APP_UNIQUE_PAGE_ID.<br>
<b>APP_USER</b>: &APP_USER.<br>
<b>AUTHENTICATED_URL_PREFIX</b>: &AUTHENTICATED_URL_PREFIX.<br>
<b>BROWSER_LANGUAGE</b>: &BROWSER_LANGUAGE.<br>
<b>CURRENT_PARENT_TAB_TEXT</b>: &CURRENT_PARENT_TAB_TEXT.<br>
<b>DEBUG</b>: &DEBUG.<br>
<b>HOME_LINK</b>: &HOME_LINK.<br>
<b>LOGIN_URL</b>: &LOGIN_URL.<br>
<b>IMAGE_PREFIX</b>: &IMAGE_PREFIX.<br>
<b>SCHEMA OWNER</b>: &SCHEMA_OWNER.<br>
<b>PRINTER_FRIENDLY</b>: &PRINTER_FRIENDLY.<br>
<b>LOGOUT_URL</b>: &LOGOUT_URL.<br>
<b>PROXY_SERVER</b>: &PROXY_SERVER.<br>
<b>PUBLIC_URL_PREFIX</b>: &PUBLIC_URL_PREFIX. <br>
<b>REQUEST</b>: &REQUEST.<br>
<b>SQLERRM</b>: &SQLERRM.<br>
<b>SYSDATE_YYYYMMDD</b>: &SYSDATE_YYYYMMDD.<br>
<b>WORKSPACE_IMAGES</b>: &WORKSPACE_IMAGES.<br>
And here's what it looks like when you run the page:



You can also create your own custom substitution strings. First, go to your application home and then click on the link shown below:



So you don't have to see the entire page, just click on the "Substitution" filter:



Then add your own, it's a key/value pairing similar to static LOVs



Add that to your Region Source, run the page and voila!

4 comments:

Louis-Guillaume said...

You can do the same with application items.

oraclenerd said...

Good point sir!

Might as well add Page Items as well.

Sue said...

Is there anyway to SET a substitution string in an anonymous PL/SQL block?

TechneTalk said...

@Sue

Assume your substitution string is MY_SUBS.

You can use it in an anonymous PL/SQL block as :MY_SUBS