Home » Developer & Programmer » Reports & Discoverer » image on reports (ORACLE FORMS 6i ,WINDOW 7 ULTIMATE(32),11G database R2)
image on reports [message #628936] Mon, 01 December 2014 05:50 Go to next message
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 #628943 is a reply to message #628936] Mon, 01 December 2014 06:35 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Where are those images stored? How will you match image name with employee number?
Re: image on reports [message #628965 is a reply to message #628943] Mon, 01 December 2014 09:52 Go to previous messageGo to next message
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 #628973 is a reply to message #628965] Mon, 01 December 2014 13:38 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Create a query; compose image name (using employee number). In layout editor, set that field's "Read from file" to "Yes"; its "Filetype" should be "Image".
Re: image on reports [message #628987 is a reply to message #628973] Mon, 01 December 2014 19:58 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 615
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 Go to previous messageGo to next message
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 #629027 is a reply to message #628992] Tue, 02 December 2014 06:46 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 615
Registered: August 2002
Senior Member
put the image in said folder. select the photo type "*.jpg".
Re: image on reports [message #629046 is a reply to message #629027] Tue, 02 December 2014 12:32 Go to previous messageGo to next message
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 #629047 is a reply to message #629046] Tue, 02 December 2014 12:33 Go to previous messageGo to next message
kilimanjaro
Messages: 151
Registered: May 2009
Location: Tanzania
Senior Member
I changed boolean to char but still not able to compile
Re: image on reports [message #629051 is a reply to message #629047] Tue, 02 December 2014 14:28 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Delete that field and start from scratch. If you want to return image name, then you'll return CHAR. If you want to return TRUE/FALSE, you'll return Boolean (it is mostly used in Format triggers).

Note that - as soon as your code hits the RETURN statement, it exits the function. In your latest example, it is the first "RETURN PIC". Therefore, nothing you put behind it (IF-THEN-ELSE) is ever executed.
Re: image on reports [message #629273 is a reply to message #629051] Fri, 05 December 2014 05:14 Go to previous messageGo to next message
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 #629328 is a reply to message #629273] Sun, 07 December 2014 09:54 Go to previous messageGo to next message
shahzad-ul-hasan
Messages: 615
Registered: August 2002
Senior Member
have your changed the field type to image./forum/fa/12353/0/
  • Attachment: 333.JPG
    (Size: 54.21KB, Downloaded 2104 times)
Re: image on reports [message #629386 is a reply to message #629328] Mon, 08 December 2014 06:22 Go to previous messageGo to next message
kilimanjaro
Messages: 151
Registered: May 2009
Location: Tanzania
Senior Member
Hello
shahzad-ul-hasan

Thank you very much .It has worked !!.
Re: image on reports [message #629390 is a reply to message #629386] Mon, 08 December 2014 06:54 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I wonder, what's the point in answering questions when people who ask them don't read those answers? I told you that 7 days ago ...
Re: image on reports [message #629500 is a reply to message #629390] Wed, 10 December 2014 00:28 Go to previous messageGo to next message
kilimanjaro
Messages: 151
Registered: May 2009
Location: Tanzania
Senior Member
Thank you too Littlefoot .Perhaps I didn't understand what you meant then but now I understand.Thank you allot.
Re: image on reports [message #629514 is a reply to message #629328] Wed, 10 December 2014 04:07 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 #629823 is a reply to message #629819] Tue, 16 December 2014 05:20 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
REP-1401 should never be the only error reported. So what other errors are you getting?
Re: image on reports [message #629824 is a reply to message #629823] Tue, 16 December 2014 05:23 Go to previous messageGo to next message
kilimanjaro
Messages: 151
Registered: May 2009
Location: Tanzania
Senior Member
Hello

No other error I'm getting apart from the formula name been mentioned in the same error .

Re: image on reports [message #629828 is a reply to message #629824] Tue, 16 December 2014 05:40 Go to previous messageGo to next message
cookiemonster
Messages: 13917
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 #629831 is a reply to message #629828] Tue, 16 December 2014 05:47 Go to previous messageGo to next message
dude4084
Messages: 222
Registered: March 2005
Location: Mux
Senior Member
One more tip: Open the image in paint and save it again by "save as" with same name and format. Reason of this unknown but it fixes problem which i have to face Very Happy
Re: image on reports [message #629832 is a reply to message #629828] Tue, 16 December 2014 05:48 Go to previous messageGo to next message
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 #629835 is a reply to message #629832] Tue, 16 December 2014 06:17 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
The first RETURN terminates the function, so you'll have to modify code to something like
begin
  pic := ...

  return case when length(pic) < 28 then null
              else pic
         end;
Re: image on reports [message #629852 is a reply to message #629819] Tue, 16 December 2014 12:22 Go to previous messageGo to next message
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:58
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 #629892 is a reply to message #629852] Wed, 17 December 2014 01:20 Go to previous message
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 .
Previous Topic: URGENT Please:::Solution for capturing Testing Metrices via any Oracle Reporting Tools
Next Topic: REP-3002: Error initializing printer
Goto Forum:
  


Current Time: Thu Mar 28 06:59:32 CDT 2024