Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Print Image using Reports (Employee Photo)

SANPATMar 31 2011 — edited Mar 31 2011
Hi Friends

I am using From 6 ,I want to print Photo of each employee while taking printout. in form it is possible for me to display , but i am not understanding how to take into Report print.

I had selected Linkfile and in pl/sql i had writen the following program. but it is giving the error. in property if i give the in source filename than it takes but taking only 1 image where as every employee is having different photo.

declare
x varchar2(60);
begin
x:='C:\ERP\IMAGE\'||:employee.empno||'.jpg';
READ_IMAGE_FILE(x,'jpg', 'imag');
NULL;
end;


Sandy

Edited by: Sandy on 31-Mar-2011 02:28

Comments

Sarah QA
hi

do you want to display the photo on report or where and that report opens by form?
you can modify the report then so for that u have to change the html files.

your photos are stored or you are accessiong by using server?


sarah

Edited by: Sarah on Mar 31, 2011 2:33 AM
SANPAT
While taking the Printout of each employee datasheet, alongwith that i want to print the photo of that particular employee.

I am using d2k form / report 6

sandy
Sarah QA
hi

did you try to search online?
if you please go online and check for
Read_image_file() built-in
example:
/* Read an image from the filesystem into an image item on the** form. In this example, the scanned picture identification** for each employee is NOT saved to the database, but is** stored on the filesystem. An employee's photo is a TIFF** image stored in a file named <Userid>.TIF Each employee's** Userid is unique. ** Trigger: Post-Query */ 
DECLARE tiff_image_dir VARCHAR2(80) := '/usr/staff/photos/'; 
photo_filename VARCHAR2(80); 
BEGIN 
/* ** Set the message level high so we can gracefully handle ** an error reading the file if it occurs */ :System.Message_Level := '25'; /* ** After fetching an employee record, take the employee's ** Userid and concatenate the '.TIF' extension to derive ** the filename from which to load the TIFF image. The EMP ** record has a non-database image item named 'EMP_PHOTO' ** into which we read the image. */ photo_filename := tiff_image_dir||LOWER(:emp.userid)||'.tif';
 /* ** For example 'photo_filename' might look like: ** ** /usr/staff/photos/jgetty.tif ** ------ ** ** Now, read in the appropriate image. */ READ_IMAGE_FILE(photo_filename, 'TIFF', 'emp.emp_photo');
IF NOT FORM_SUCCESS THENMESSAGE('This employee does not have a photo on file.');
END IF;:SYSTEM.MESSAGE_LEVEL := '0';
END;
sarah
Amatu Allah Neveen Ebrahim
Hi

Sandy this is done throug using ...

1.a formula column which in turn return the pic of an employee in a report,

2.u have also to create a field in ur report layout to reference this formula > column > column type > Formula

3. It's datatype > character.

4. The file format should also be > image

5.Read from File >yes

Pls have a look here ....

Hope this helps...

Regards,

Abdetu...
SANPAT
Already I am able to see the Image on Form, but now i want to take out the printout as hardcopy in which i need the photo should also print.

In from 6 i had given the following code and is working successful. but now looking for report
declare
x varchar2(60);
begin
x:='C:\ERP\IMAGE\'||:employee.empno||'.jpg';
READ_IMAGE_FILE(x,'jpg', 'imag');
NULL;
end;

sandy
haven't u seen the Link i have just posted yet ?
SANPAT
Yes i had seen the link and as per link i had used the following code but now i am getting the following error message

msg-00100 user defined exception


function CF_1Formula return Char is
v_handle utl_file.file_type;
v_file_dir VARCHAR2(60) := '/erp/image/';
begin
-- The UTL_FILE is used to check if the file exists in the directory.
-- If it is unable to open the file then an exception will thrown.
-- We will catch the exception and return null as the final URL.
-- Without this exception for any invalid path, the report will error out
-- and not work as expected.
v_handle := utl_file.fopen(v_file_dir, :empno, 'R');
utl_file.fclose(v_handle);
RETURN v_file_dir||:empno;
exception
when others then
srw.message(100,SQLERRM);
return null;
end;
Hi

Pls don't worry the
ORA-00100: no data found
means there is no data actually found...

if u already have data then make sure the path is correct,etc.

Hope this helps...

Regards,

Abdetu...
SANPAT
But already I am having a files in c:\erp\image\ (folder) with jpg extension.

sandy
Amatu Allah Neveen Ebrahim
Hi
But already I am having a files in c:\erp\image\ (folder) with jpg extension.
But u intialize another path in ur code e.g.
v_file_dir VARCHAR2(60) := '/erp/image/';
Then it's well expected to get the Ora

Hope this helps... :)

Regards,

Abdetu...
SANPAT
This is my code can you explain me where i am doing wrong. I am using jpg extinsion file.


function CF_1Formula return Char is
v_handle utl_file.file_type;
v_file_dir VARCHAR2(60) := 'C:\ERP\IMAGE\';
begin
v_handle := utl_file.fopen(v_file_dir, :EMPNO, 'R');
utl_file.fclose(v_handle);
RETURN v_file_dir||:EMPNO;
exception
when others then
srw.message(100,SQLERRM);
return null;
end;

sandy
Amatu Allah Neveen Ebrahim
Pls cool down :)

Yes u r wrong in path but not in words it's on the slashes u used slash not back slash

pls try intialize it as...
v_file_dir VARCHAR2(60) := 'C:/ERP/IMAGE/';
Hope this helps... :)

Regards,

Abdetu
SANPAT
But now i am unable to see the image

function CF_1Formula return Char is
v_handle utl_file.file_type;
v_file_dir VARCHAR2(60) := 'C:/ERP/IMAGE/';
begin
v_handle := utl_file.fopen(v_file_dir, :EMPNO, 'R');
utl_file.fclose(v_handle);
RETURN v_file_dir||:EMPNO;
exception
when others then
srw.message(100,SQLERRM);
return null;
end;

sandy
Amatu Allah Neveen Ebrahim
Hi

Pls check the properties i mentioned before and stated in the link carefully ...

Specially the visible property > yes

Try other extentions

Hope this helps...

Regards,

Abdetu...

Edited by: Abdetu on Mar 31, 2011 4:13 AM
SANPAT
Hi

visible property > yes --- already it is set

Tried all the formats like bmp,tif, gif etc but still it is not showing image, for that i had given a conditional formating if image is null then show red colour where it is showing red colour .

sandy
Sorry am out of suggestion :(
Sarah QA
hi

try the following link...
http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwcontxt/props/pi_col_read_from_file.htm


sarah
1 last thing i hope u set the Width to 100 or 200
if not pls share us the property u use...
SANPAT
Previously i set to 100 but later i increased to 200 then 300 till upto 1000 but no image.

sandy
Sandy u r doing a good job by trying that it also might be the size of picuture even it's no effect but it's a good try...
well can u share us the properties of the formula pls.
i used this code before long time ago it was very helpful...
what patch r u using for forms and reports 6i ?
SANPAT
I am Using Report 6.

Properties :

Name=Image1
Source=CF_1
vISIBLE =Yes
Column Type = Formula
Datatype =Character
Width=100 (tried upto 1000)
value if null=
break order none
read from file =yes
file format=image

sandy
Pretty Good ,r u trying to run the report independed or through the the parameter form;pls try to run it stand alone.
which patch r u using in forms & report 6i ? ; may be u have a bug and needs to upgrade.
InoL
Datatype =Character
This is not correct, since an image is not of datatype Character.
Please follow Sarah's link. It is really simple. Try this simple query first:
select 'c:\temp\myphoto.jpg' photo
from dual
and set the following properties for the field in the layout:
Read from file = Yes
File Format = Image

Alternatively: store the images in the database in a BLOB column and select this column in your query.
1 - 23
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 28 2011
Added on Mar 31 2011
23 comments
1,228 views