user402282
user402282

Reputation: 41

Creating Hyperlink in IR report

How, in oracle apex, can I link Information in a table to a different external page from an interactive report column?

The page being linked to will display different data, depending on which IP the user clicked.

I know hyperlink uses href but oracle apex uses links but am not getting any to work

an example of what am doing is

i have an IR report and one of the columns has IP addresses , when the user clicks the IP address

it suppose to send them to a different location on our server.

 100.100.100.100- should send me to the Printers

 100.100.100.101 -should send me to Drivers

Upvotes: 0

Views: 763

Answers (1)

Littlefoot
Littlefoot

Reputation: 142705

Here's how I understood the question.

  • TEST CTE represents your table
  • one of its columns is `ip_address'
  • depending on that value, you want to navigate to some URL

One option to do it is to use CASE (or DECODE, but - CASE is easier to read & maintain) and explicitly decide where you want to go, depending on each ip_address value - that's what my example shows.

Another is to expand the table (alter table ...), add another column and put exact URL in there. That scales better, because - if you ever add a new row into that table, you'll have to edit interactive report's query and add yet another CASE option, which is stupid. I suggest you to alter table.

Anyway, here you go: it is an interactive report query. Nothing special about it, just pay attention to edit link column's properties and set "Escape special characters" to "No".

with test (id, name, ip_address) as
  (select 1, 'Google', '100.100.100.100' from dual union all
   select 2, 'Bing'  , '100.100.100.101' from dual
  )
select 
  id, 
  name,
  '<a href="' || case 
                  when ip_address = '100.100.100.100' then 'https://www.google.com'
                  when ip_address = '100.100.100.101' then 'https://www.bing.com'
                end
              || '" target="_blank">' || ip_address || '</a>' as link
from test;              

[EDIT]

If table contains URL itself, then I'd suggest something like this:

with test (id, name, ip_address, url) as
  (select 1, 'Google', '100.100.100.100', 'https://www.google.com' from dual union all
   select 2, 'Bing'  , '100.100.100.101', 'https://www.bing.com'   from dual
  )
select 
  id, 
  '<a href="' || url || '" target="_blank">' || name || '</a>' as link
from test;              

This query will show name as a hyperlink. Why? Because I think that seeing e.g. "Google" is more acceptable than seeing e.g. "100.100.100.101". People usually prefer names over numbers. See if it helps.

Upvotes: 1

Related Questions