tonyf
tonyf

Reputation: 35577

Sorting column with hyperlink case condition in an Interactive Grid report

I have the following hyperlink case statement within my Interactive Grid report:

SELECT COL1, COL2,
...
   CASE IS_ACTIVE 
     WHEN 'Y' THEN  '<a href="' || APEX_PAGE.GET_URL(p_page => 22) || '">'||MY_LINK_ID||'</a>' 
     ELSE MY_LINK_ID
   END MODAL_LINK    
FROM TABLE_A

The problem is, prior to adding this case statement, my interactive grid report column was sorted nicely in ascending order, that is:

100-1 (is_active = 'N')  
100-2 (is_active = 'Y')  
100-3 (is_active = 'N')  
100-4 (is_active = 'N')  

Now with the above case statement and the only means of sorting this IG column is from the front-end, but the order is now:

100-1 (is_active = 'N')  
100-3 (is_active = 'N')  
100-4 (is_active = 'N')  
100-2 (is_active = 'Y')  

which is incorrect as the value in the backend for 100-2 is appearing as javascript:apex.navigation.dialog(f?p=......') etc and not 100-2

How can I solve this issue?

Upvotes: 1

Views: 287

Answers (1)

Jeffrey Kemp
Jeffrey Kemp

Reputation: 60312

You could add extra hidden html to affect the sorting order:

'<!--' || MY_LINK_ID || '-->'
|| CASE IS_ACTIVE 
 WHEN 'Y' THEN  '<a href="' || APEX_PAGE.GET_URL(p_page => 22) || '">'||MY_LINK_ID||'</a>' 
 ELSE MY_LINK_ID
END MODAL_LINK

Upvotes: 2

Related Questions