Displaying Icons in Apex Reports

Problem

You want an icon on each line, example delete icon.

Solution

Seen a few solutions, but I put two together to make this work.

Add a column to your interactive report query to display your icon.


Upload a file in shared components > files > Workspace files
(Note the reference)




Go back to the column that you created in your report (del_icon), change the type to link.
Change the link text to <img src="#WORKSPACE_IMAGES#deleteicon_enabled.gif" />  
i.e the reference when you uploaded your file.

Now we want something to happen when the user clicks on the icon.

Create a hidden non-database text column somewhere on your page



Now go back to your del_icon column that you added to your interactive report.
Change the link target to point back to your page. You want it to pass a key value back to the hidden column that you created.


Create a process after header.

Declare
Cursor c_del is 
   select 1 
   from GNS_DS_RICEW_components 
where ricew_id = :P7_RICEW_ID
and sequence_number = :P7_DEL_SEQUENCE_NUMBER;
v_test NUMBER;
Begin
Open c_del;
Fetch c_del into v_test;
If c_del%FOUND Then
-- Delete Person
delete from GNS_DS_RICEW_components 
where  ricew_id = :P7_RICEW_ID
and sequence_number = :P7_DEL_SEQUENCE_NUMBER;
commit;
apex_application.g_print_success_message := 'Component Removed';
End If;
Close c_del;

:P7_DEL_SEQUENCE_NUMBER := null;

End;

It's important to set you hidden variable to null afterwards!

Finally, make sure that your process has a condition on it:



Result


Acknowledgements

http://apps2fusion.com/at/kr/391-oracle-apex-person-details-tutorial-02-delete-functionality
Note the syntax for displaying the image in this post is not quite right, and they forget to clear the variable in the delete process.

Comments