My Oracle Support Banner

How To Escape The "#" Character In APEX When Setting A Value In A Link (Doc ID 2379732.1)

Last updated on AUGUST 04, 2018

Applies to:

Oracle Application Express (APEX) - Version 5.1.3.00.05 and later
Information in this document applies to any platform.

Goal

How to escape the "#" character in APEX when setting a value in a link

For example:

Have a Classic Report in APEX which has these 4 columns: VALUE1, VALUE2, VALUE3, LINKCOL.
The VALUE columns are queried from the database. The link LINKCOL is set up to link to another Page (4) in the application. LINKCOL is configured to pass the 3 VALUE columns into text fields on the destination page.

It's set up like this:

P4_ItemName - Value being passed to Page 4
P4_VALUE1 - \#VALUE1#\
P4_VALUE2 - \#VALUE2#\
P4_VALUE3 - \#VALUE3#\

Included the "\" characters in case the values contain spaces. This allows spaces to be passed in the URL to Page 4.
However, if the VALUE columns ever contains a "#" character, it breaks the URL and does not set the correct value in the P4_VALUE1 text field on Page 4.

For example, if VALUE1 = "C##USERNAME", that field in the URL that is built, looks like this: %CC##USERNAME\
On Page 4, in the text field, you only see: \C

Tried using APEX_ESCAPE.HTML(value1) in the original query for the Classic Report, but that didn't work because the escaped value contains its own "#".  So how to pass "#" in a link column to another APEX Page?

Note: that if VALUE1 does not contain any "#" characters (e.g. USERNAME), then the URL that is built looks like this for that value: %5CUSERNAME%5C
And P4_VALUE1 text field correctly shows: USERNAME
 

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.