I know this question must have been asked infinity times, but I cannot find an answer that works.
I'm using a decode statement in an oracle apex interactive report. The idea is that if the value is null, display a dash, and if not, display a check mark image.
In my SQL query for the report I have:
select "col1",
"col2",
decode (col3, NULL, '-', '<img src="#APP_IMAGES#check.png" alt="check mark" />') "col3"
from "#OWNER#"."table"
On the report I see all the columns and where col3 is null I get a dash, but where not null, it prints
<img src="path/to/check.png" alt="check mark" />
Looking at the html it's actually printing out < > instead of <>.
Should be an easy fix to escape those characters, but I cannot figure out how to escape the < and > characters.
Interestingly, the site where I got the idea has no issue with these characters: http://www.ruleworks.co.uk/apex/howto-decode-doc.asp
Got to the col3 attributes. In APEX 5 you'll find an option called "Escape special characters". Switch it to "no" and you'll see your HTML.
However, be careful with this setting as you can easily introduce XSS (Cross Site Scripting). In your case, you won't because you're not using user supplied data as part of col3, but it's good to know.
A better approach is to try to use the "HTML Expression" field (also an attribute of the column). Then col3 could return the image and the HTML Expression would be:
select ...
, decode (col3, NULL, 'blank.gif','check.png') col3_flag
...
HTML Expression:
<img src="#APP_IMAGES##COL3_FLAG#"/>