1
votes

I am trying to utilize an APEX Interactive Report and have a hyperlink to different page in the app based on the result of a case statement. I am guessing I am not formatting the href correctly here. Any help is greatly appreciated. In this example, when 'section' = 'Confirm the Project' I want the user to be able to click in the column for that row and it will take them to page 2.

Thanks,

select
section,
status,
case when section = 'Confirm The Project' then 
('<a href="'|| sys.htf.escape_sc('f?
p='||:APP_ID||':2:'||:APP_SESSION||':::2,RIR:IR_Status:Active:') ||'">')     else null end as Link
from 
crd_trans_final_view
1
What happens when you run it?Tony Andrews
I would just get the link text when I did this. Thanks!Ewaver
Edit the report definition and change the display attribute of column Link to "Standard Report Column". By default it will be "Display as text (escape HTML)".Tony Andrews
Hi, I did do that before and it just shows as blank (not null but blank as null is '-' in the report. That is what made me question the syntax of of the href. To your knowledge does the syntax look correct? thksEwaver
I see the problem - your link has no text, so there is nothing to see. You need <a href="...">Some text here</a> then it will display "Some text here" as the link.Tony Andrews

1 Answers

1
votes

Alternatively, you can do it by using the column link feature of ORACLE APEX. Just remove the case statement or paste this code to your source of interactive report

select
section, 
status,
Link
from 
crd_trans_final_view

You forgot to mention what version of Oracle APEX you are using:

For 4.2

  1. Go to the REPORT ATTRIBUTE section
  2. Then under LINK COLUMN choose Link to Custom Target
  3. Then choose appropriate LINK ICON, it can be any icon or just text depending on what you want
  4. Then change TARGET to URL
  5. Then Paste this to the URL box
    javascript:removeURL('#SECTION#');
  1. Then Go to MAIN PAGE > JAVASCRIPT > Functions and Global Variable Declarations and paste this code:
    function removeURL(section){
      if (section  == 'Confirm The Project'){ 
       window.open('f?p='+$v('pFlowId')+':2:'+$v('pInstance')+':::::');
       }
    }
  1. Then run and check.

For APEX 5 version

1.Go to the Column and change its type to Link
2.Then under Link , Choose URL as TARGET
3.Then choose The column name as Link TEXT
4.Then follow the steps above from 5 to 7.

Note that the string/value to be compared should be equal to the value stored in the database.

Hope this helps