Using Links in SQL
Joe RMay 3 2010 — edited May 4 2010version 3.2.1
Hello,
I'm having difficulty constructing a link using SQL. I have a SQL Query report that I need to define the ID as a link under specific conditions.
When the "section" is "IT" and the "consultant flag" is 'Y' display the ID as a link.
When the "section" is "IT" and the "consultant flag" is 'N' just display the ID as text.
When the "section" is "HR" (or not "IT") display the ID as a link.
This is what I have so far:
SELECT
CASE WHEN u.section = 'IT' and r.consultant_flg = 'Y' THEN
'[a href="f?p=&APP_ID.:3:&APP_SESSION.::::P3_ID:'||e.empid||'">EMPID[/a]'
WHEN u.section = 'HR' THEN
'[a hre f="f?p=&APP_ID.:3:&APP_SESSION.::::P3_ID:'||e.empid||'">EMPID[/a]'
ELSE e.empid
END AS "ID"
...
...
FROM ...
**I substitued the "< >" brackets with "[ ]" so the code wouldn't actually resolve.
The result is that the ID column is displayed as "EMPID" instead of the actual ID but is an actual link and the else condition won't even allow the report to compile.
1) How can I display the actual ID value for the link?
2) How can I have the ID displayed as text when "section" is "IT" and "consultant flag" is 'N'?
Thanks,
Joe