image on reports [message #628936] |
Mon, 01 December 2014 05:50 |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
Hello friends,
Please if you can assist me on how to display Images on report builder .Eg; The image should match with the employee number entered on parameter.Thank you.
|
|
|
|
Re: image on reports [message #628965 is a reply to message #628943] |
Mon, 01 December 2014 09:52 |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
Hi Littlefoot
Sorry for the wrong information .
The images are stored on a folder .Now I want to link the Image on the report.The image name is the employee number.
I guess that's all.Thank you .
|
|
|
|
Re: image on reports [message #628987 is a reply to message #628973] |
Mon, 01 December 2014 19:58 |
shahzad-ul-hasan
Messages: 643 Registered: August 2002
|
Senior Member |
|
|
Create a formula coulmn and put this code in that. set its "File Format" to "Image".
function CF_1Formula return Char is
DIRX VARCHAR2(60) :='D:\Photo\';
PIC VARCHAR2(85);
BEGIN
PIC:=DIRX ||:stuid||'.JPG';
return pic;
if length(pic) < 28 then
pic:=null;
return pic;
end if;
end;
|
|
|
Re: image on reports [message #628992 is a reply to message #628987] |
Mon, 01 December 2014 23:55 |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
Hello shahzad
I did as you said but unfortunately the cursor blinks at the "return PIC" lines.
When I disable the lines it compile successful but cant run report .
Thank you.
|
|
|
|
Re: image on reports [message #629046 is a reply to message #629027] |
Tue, 02 December 2014 12:32 |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
function B_1FormatTrigger return boolean is
DIRX VARCHAR2(60) :='C:\DMSS-C\STAFF\';
PIC VARCHAR2(85);
BEGIN
PIC:=DIRX ||:members_number||'.JPG';
return pic;
if length(pic) < 28 then
pic:=null;
return pic;
end if;
end;
|
|
|
|
|
Re: image on reports [message #629273 is a reply to message #629051] |
Fri, 05 December 2014 05:14 |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
Hello Friends,
I have tried to do as you instructed but im getting this error
REP 0534 You can only export from text entry field.
What exactly shall I do?Put the code in a function or link file image?
how should the code look like ?
my pics are stored on 'C:\DMSS-C\STAFF\'.
I will appreciate your help dearly .
Thank you.
|
|
|
|
|
|
|
Re: image on reports [message #629514 is a reply to message #629328] |
Wed, 10 December 2014 04:07 |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
Hello Shahzad-ul-hasan
One more thing please.If Employee doesn't have a pic,what shall I put as the initial value?
I tried to put the path to an image on the property pallete but dosn't work.
Thank you.
|
|
|
Re: image on reports [message #629611 is a reply to message #629514] |
Fri, 12 December 2014 06:07 |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
Hello Everyone
In regard to the subject,everything worked fine.The problem is if an 'Employee' doesn't have a pic ,what shall I put as an initial value?I tried all means with successful compilation but still not working.Thank you all.
|
|
|
Re: image on reports [message #629793 is a reply to message #628936] |
Tue, 16 December 2014 03:19 |
dude4084
Messages: 222 Registered: March 2005 Location: Mux
|
Senior Member |
|
|
I have used the following function to read image and then display. In case no image found theni show"0.jpg" image which says "no image found"
function CF_imageFormula return Char is
l_filename text_io.file_type;
BEGIN
l_filename := text_io.fopen ('c:\check\' || :pcode ||'.jpg', 'r');
text_io.fclose (l_filename);
RETURN 'c:\check\' || :pcode ||'.jpg' ;
EXCEPTION
-- the report photo doesn't exist
WHEN OTHERS THEN
BEGIN
l_filename := text_io.fopen ('C:\check\0.JPG', 'r');
text_io.fclose (l_filename);
RETURN 'C:\check\0.jpg';
EXCEPTION
-- the report photo 'default_image.jpg' doesn't exist
WHEN OTHERS THEN
RETURN NULL;
END;
end;
|
|
|
Re: image on reports [message #629819 is a reply to message #629793] |
Tue, 16 December 2014 04:58 |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
Hello Dude4084
Thank you for coming to the rescue
.I have used your code as below and it compiled successful .Unfortunately no display and i'm getting error REP-1401 for employees having PICS.BUt when I enter identification_number of which the employee doesn't have pic the report runs. Thank you.
function CF_imageFormula return Char is
l_filename text_io.file_type;
BEGIN
l_filename := text_io.fopen ('C:\DMSS-C\KIDS\' || :identification_number ||'.jpg', 'r');
text_io.fclose (l_filename);
RETURN 'C:\DMSS-C\KIDS\' || :identification_number ||'.jpg' ;
EXCEPTION
-- the report photo doesn't exist
WHEN OTHERS THEN
BEGIN
l_filename := text_io.fopen ('C:\DMSS-C\KIDS\0.JPG', 'r');
text_io.fclose (l_filename);
RETURN 'C:\DMSS-C\KIDS\0.jpg';
EXCEPTION
-- the report photo 'default_image.jpg' doesn't exist
WHEN OTHERS THEN
RETURN NULL;
END;
end;
|
|
|
|
|
Re: image on reports [message #629828 is a reply to message #629824] |
Tue, 16 December 2014 05:40 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Change the image item to a normal item, so you can see on the report itself what value you are getting for the file name.
|
|
|
|
Re: image on reports [message #629832 is a reply to message #629828] |
Tue, 16 December 2014 05:48 |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
Hello
The below code worked fine.The only problem is how to return either null or static file path .Thank you.
function CF_1Formula return char is
DIRX VARCHAR2(60) :='C:\DMSS-C\PICS\';
PIC VARCHAR2(85);
BEGIN
PIC:=DIRX ||:members_number||'.JPG';
return pic;
if length(pic) < 28 then
pic:=null;
return pic;
end if;
end;
|
|
|
|
Re: image on reports [message #629852 is a reply to message #629819] |
Tue, 16 December 2014 12:22 |
dude4084
Messages: 222 Registered: March 2005 Location: Mux
|
Senior Member |
|
|
What is the format of the picture of the employees? Can you change the field property to normal text as told by cookiemonster as follow and tell us the result: Change the image item to a normal item, so you can see on the report itself what value you are getting for the file name.
Reply my above two questions properly
milikiel wrote on Tue, 16 December 2014 15:58Hello Dude4084
Thank you for coming to the rescue
.I have used your code as below and it compiled successful .Unfortunately no display and i'm getting error REP-1401 for employees having PICS.BUt when I enter identification_number of which the employee doesn't have pic the report runs. Thank you.
function CF_imageFormula return Char is
l_filename text_io.file_type;
BEGIN
l_filename := text_io.fopen ('C:\DMSS-C\KIDS\' || :identification_number ||'.jpg', 'r');
text_io.fclose (l_filename);
RETURN 'C:\DMSS-C\KIDS\' || :identification_number ||'.jpg' ;
EXCEPTION
-- the report photo doesn't exist
WHEN OTHERS THEN
BEGIN
l_filename := text_io.fopen ('C:\DMSS-C\KIDS\0.JPG', 'r');
text_io.fclose (l_filename);
RETURN 'C:\DMSS-C\KIDS\0.jpg';
EXCEPTION
-- the report photo 'default_image.jpg' doesn't exist
WHEN OTHERS THEN
RETURN NULL;
END;
end;
|
|
|
Re: image on reports [message #629892 is a reply to message #629852] |
Wed, 17 December 2014 01:20 |
kilimanjaro
Messages: 151 Registered: May 2009 Location: Tanzania
|
Senior Member |
|
|
Hello Dude4084
The picture file format is JPG. I changed the property to text and the results are the same;
For the employees with pictures the report don't run with an error 'REP-1401 cf_imageformula':Fatal Pl/SQL error occured.
For the employees without pictures the report runs and the formula displays some characters and numbers on the field .
|
|
|