Focal Point
[CLOSED] Dynamic image files in row data

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/146107945

October 13, 2010, 03:49 PM
redapple
[CLOSED] Dynamic image files in row data
Hello All,

I'm creating a report that displays student details (school,name,id, etc.), and I've been asked to display the students photo.

Student data is in Oracle, photographs are stored on a network drive as student_id.jpg (123.jpg, 987.jpg).

I've reviewed the on-line help "Adding an Image to a Report." My needs closely match the example about using a BLOB field in a Report column. I differ, obviously, on using files not fields.

Any insight on how to adapt that example, or pointing me in the right direction is greatly appreciated.

Thanks.

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6.11
Developer Studio on Windows XP. Server Components running on Windows Server 2003.
Excel, HTML, PDF
October 13, 2010, 03:55 PM
Francis Mariani
Depends on the report format - different syntax is used to include images in HTML and PDF reports.

Here's some reading: Image in row of a PDF report

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 13, 2010, 04:19 PM
redapple
Francis,

Thanks for the lightning fast response.

I've re-read that post and I'm still a little confused about how to apply it to my situation.

Question 1:
 TYPE=DATA, COLUMN=N3, IMAGE=(LOGO),SIZE=(2.0 .5),$ 


What is the column reference, I've seen N3's and P4's used in other examples. What do those values mean? I've tried searching for documentation but haven't found the right search terms to self-educate.

Question 2:
DEFINE FILE CAR
LOGO/A15=IF COUNTRY EQ 'ENGLAND' THEN 'IMAGE1' ELSE 
         IF COUNTRY EQ 'ITALY' THEN 'IMAGE2' ELSE 'IMAGE3';
END


Should I include the full file path to the student images as part of the LOGO compute? Or as part of the TYPE=DATA?


My current code is:
TABLE FILE DTBL_STUDENTS
PRINT 
     COMPUTE STUDENT_IMG/A100V = 'J:\photos\' || DTBL_STUDENTS.DTBL_STUDENTS.STUDENT_ID || '.JPG';
     'DTBL_STUDENTS.DTBL_STUDENTS.STUDENT_NAME'
     'DTBL_STUDENTS.DTBL_STUDENTS.STUDENT_CURRENT_GRADE_CODE'
BY 'DTBL_STUDENTS.DTBL_STUDENTS.STUDENT_ID'
HEADING
""
FOOTING
""
WHERE DTBL_STUDENTS.DTBL_STUDENTS.STUDENT_ID EQ '1227731' OR '723252' OR '1226906';
ON TABLE SET PAGE-NUM OFF 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=9,
$
TYPE=DATA,COLUMN=C5,
     IMAGE=(STUDENT_IMG),
     SIZE=(2.000000 5.000000),


Produces the following:

   
STUDENT_ID STUDENT_IMG STUDENT_NAME STUDENT_CURRENT_GRADE_CODE 
1226906 J:\photos\1226906.JPG Student Name 09 
1227731 J:\photos\1227731.JPG Student Name 09 
723252 J:\photos\723252.JPG Student Name 12 


No photos, no error messages.

Thanks again for looking!

This message has been edited. Last edited by: redapple,


WebFOCUS 7.6.11
Developer Studio on Windows XP. Server Components running on Windows Server 2003.
Excel, HTML, PDF
October 13, 2010, 04:47 PM
Waz
Question 1, these are column references.

N - The column number from the left.
B - The By field column number
P - The column number from the left Not including NOPRINTS.

Question 2.
For HTML you need a web location to the images, for PDF the images need to be in the path. so WebFOCUS can attach the image (Include) to the PDF document.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 13, 2010, 05:49 PM
Francis Mariani
PDF example:

-* File fmtest1.fex

DEFINE FILE CAR
COUNTRYX/A10 = IF COUNTRY EQ 'W GERMANY' THEN 'GERMANY' ELSE COUNTRY;
FLAG_IMG/A40 = LOCASE(10, COUNTRYX, 'A10') || '_flag_s';
END

TABLE FILE CAR
SUM
COUNTRY
SALES

FLAG_IMG NOPRINT

BY COUNTRY AS ''

ON TABLE SET STYLE *
TYPE=REPORT, SQUEEZE=ON,
FONT='ARIAL', SIZE=8,
BORDER=1, BORDER-COLOR=SILVER,
$
TYPE=DATA, COLUMN=COUNTRY(1), IMAGE=(FLAG_IMG), $
ENDSTYLE

ON TABLE PCHOLD FORMAT PDF
END

HTML example:
-* File fmtest2.fex

DEFINE FILE CAR
COUNTRYX/A10 = IF COUNTRY EQ 'W GERMANY' THEN 'GERMANY' ELSE COUNTRY;
FLAG_IMG/A40 = LOCASE(10, COUNTRYX, 'A10') || '_flag_s';
END

TABLE FILE CAR
SUM
COMPUTE FLAG/A100 = '<img src="/approot/baseapp/' || FLAG_IMG || '.gif" />'; AS ''
COUNTRY
SALES

FLAG_IMG NOPRINT

BY COUNTRY NOPRINT

ON TABLE SET STYLE *
TYPE=REPORT, SQUEEZE=ON,
FONT='ARIAL', SIZE=8, $
ENDSTYLE

END


For PDF, images must be in the Application Path on the reporting server. Put the images in Application Folder baseapp.

For HTML, images must be available to the web server. Put the images in baseapp on the web server approot directory. Usually (in a single tier environment) this folder is the same as the reporting server application folder.

Images available here:

Flag images


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 13, 2010, 05:50 PM
Francis Mariani
I'm not sure if there's a nice and neat way to do this for both HTML and PDF, other than using Dialogue Manager to bypass certain lines of code depending on which format was selected.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 13, 2010, 07:54 PM
Tom Flynn
quote:
Student data is in Oracle, photographs are stored on a network drive as student_id.jpg (123.jpg, 987.jpg).

  
1. 'J:\photos\' || DTBL_STUDENTS.DTBL_STUDENTS.STUDENT_ID || '.JPG' means the photos are on the J Drive of the
                                                                    Reporting Server in the APP Folder photos.
    1a. If they are not actually on the Reporting Server J Drive, see next idea.
2. APP MAP to the Network Drive that houses the images via edasprof.prf (best way to do it)
    2a. May need the actual IP address.
3. FTP "ALL" images to the Reporting Server, into an Application folder (worst case)
    3a. The Reporting Server has no idea where these images are...
4. Wouldn't you have to JOIN the Student_ID from ORACLE to the STUDENT_ID on the J Drive to get the correct picture 
   with the correct student? Maybe not...

Here is an example post of what "I" have done to get images in PDF/PPT formats...

hth

Tom

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe