Home » Developer & Programmer » Reports & Discoverer » print images on report based on data (Reports6i)
print images on report based on data [message #583099] Thu, 25 April 2013 15:21 Go to next message
m.abdulhaq
Messages: 254
Registered: April 2013
Location: Ajman
Senior Member
Hello , how can i print the stored images in reports 6i from database, based on the condition,that suppose if i have one field approval status whose flag is either 3 or 1 , based on this flag ,if the status is 3 then image should be displayed otherwise no.please guide me to the rest of the process.


CREATE TABLE FT_GALVA (GALV_NO VARCHAR2(2),GALV_APPR_ST NUMBER,img_name varchar2(30),PIC_GALV BLOB)


Create or Replace directory image_dir as 'e:\image_dir';

Grant all on directory image_dir to public


/* Formatted on 2013/04/25 23:50 (Formatter Plus v4.8.8) */
CREATE OR REPLACE PROCEDURE insert_image_file (
   p_id                NUMBER,
   p_status            NUMBER,
   p_image_name   IN   VARCHAR2
)
IS
   src_file   BFILE;
   dst_file   BLOB;
   lgh_file   BINARY_INTEGER;
BEGIN
   src_file := BFILENAME ('IMAGE_DIR', p_image_name);

   -- insert a NULL record to lock
   INSERT INTO ft_galva
               (galv_no, galv_appr_st, img_name, pic_galv
               )
        VALUES (p_id, p_status, p_image_name, EMPTY_BLOB ()
               )
     RETURNING pic_galv
          INTO dst_file;

   -- lock record
   SELECT     pic_galv
         INTO dst_file
         FROM ft_galva
        WHERE galv_no = p_id
          AND img_name = p_image_name
          AND galv_appr_st = p_status
   FOR UPDATE;

   -- open the file
   DBMS_LOB.fileopen (src_file, DBMS_LOB.file_readonly);
   -- determine length
   lgh_file := DBMS_LOB.getlength (src_file);
   -- read the file
   DBMS_LOB.loadfromfile (dst_file, src_file, lgh_file);

   -- update the blob field
   UPDATE ft_galva
      SET pic_galv = dst_file
    WHERE galv_no = p_id
      AND img_name = p_image_name
      AND galv_appr_st = p_status;

   -- close file
   DBMS_LOB.fileclose (src_file);
END insert_image_file;

execute insert_image_file(1,3,'a.jpg');










[/CODE]
Re: print images on report based on data [message #583100 is a reply to message #583099] Thu, 25 April 2013 15:30 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
if the status is 3 then image should be displayed otherwise no

Create a format trigger for the image:
return (:status = 3);
Re: print images on report based on data [message #583209 is a reply to message #583100] Sat, 27 April 2013 05:00 Go to previous message
m.abdulhaq
Messages: 254
Registered: April 2013
Location: Ajman
Senior Member
Thanks littlefoot.
Previous Topic: Excluding SQL query data when linked with XML query
Next Topic: Discoverer Desktop : "Failed to update system registry, Please try using REGEDIT"
Goto Forum:
  


Current Time: Tue Nov 26 23:36:07 CST 2024