Purpose:
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 display images in report
Step1: Create a new page
Step 2: Create a region èreportèclassical 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 // if the image already available in the database
THEN
'<img alt="' //HTML tag
|| 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.
Sample screen shot
sample screen shot show the image in classical report
Conclusion
The user Fetch images from Database also display images in report using APEX.
Hi Doyen, I am trying to display images in an IR, but I got a square with a cross instead of the image, your post is helpful but I have trouble to understand exactly what to set in Step 3, I don't find Column Name in Report attributes, is it a Region property? or a Column property? or the Report attributes properties?
ReplyDeleteI am running Apex 5 and I don't find the property to set.
I know the get_blob_file_src is getting the data properly because I display the column as text and has all the a, p, I, p_pk data
Thanks in advance
Leticia