Displaying images in a Report

Introduction

This document shows user how to include images in report.By assumption we will upload a image to work space and call that particular image through HTML using image name and displays in classical or interactive report.

Another way is that, the user can able to retrieve images from the Database.

Benefits:

  • User able to know prior information about subject
  • Faster Turnaround.
  • Report is used to get the information if user include an image.it will be more helpful.

Steps To Follow

 Step1:

Create a new page

Step 2:

     Create a region    report    classic or interactive report   Name for the report  SQL query   follow the below query.

Case and Decode both methods can be done. Based on Requirement modify the query.

Example:

CASE

WHEN gender = ‘MALE’ AND emp_image IS NULL THEN

‘<img src=”#WORKSPACE_IMAGES#not_found_male.jpg” width=”75px;” height=”75px;”/>’ — uploaded default male icon in workspace and checking for the condition image is available in table or not.

WHEN gender = ‘FEMALE’ AND emp_image IS NULL THEN

‘<img src=”#WORKSPACE_IMAGES#not_found_female.jpg” width=”75px;” height=”75px;”/>’  –uploaded default Female icon in workspace ans checking for the condition image is available in table or not.

WHEN emp_image IS NOT NULL THEN   –if  the image already available in the database

‘<img alt=”‘|| apex_escape.html_attribute (c.first_name)  — this function returs name of the employee

|| ‘” title=”‘  ||apex_escape.html_attribute (c.first_name)

|| ‘” style=”border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;” ‘ –Giving style for the image using HTML tag

|| ‘src=”‘ || apex_util.get_blob_file_src (‘P61_EMP_IMAGE’, c.party_id) — Generates a call to the apex_util.get_blob_file that can be used to  download a BLOB column content

— Only generates usable output if called from a valid APEX session

 ‘P61_EMP_IMAGE’    Name of valid application page ITEM that with type FILE, and source type of  DB column

 c.party_id     Primary key column

                           || ‘” height=”75″ width=”75″ />’

END “img”

Step 3:

Make the report column as standard report column Report attributes    column name    column attributes display as standard report column.

Conclusion

         The user can fetch images from Database and also display images in report using APEX.

Recent Posts