Focal Point
[CLOSED] Image in PDF Report appended with another column/value.

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

March 04, 2019, 05:13 PM
srajeevan
[CLOSED] Image in PDF Report appended with another column/value.
Hi,

I have been working on showing images in a PDF report as data row.
I have to append a value and image and show that in a column.
I can do that in HTML,but how do i achieve that in PDF.

Here is the sample code i use to show images in a PDF.I need to append any column along with the column N1.
Not sure where i will append.
In HTML format i can append that in a define field and use.

  
-*WHENCE img1 PNG
-*-RUN
-*-EXIT
DEFINE FILE WF_RETAIL
ICON_PATH/A500V=
IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Accessories' THEN 'IBFS:/WFC/Repository/Apps/Images/green_icon.png'
ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Camcorder' THEN 'IBFS:/WFC/Repository/Apps/Images/green_icon.png'
ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Computers' THEN 'IBFS:/WFC/Repository/Apps/Images/green_icon.png'
ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Media Player' THEN 'IBFS:/WFC/Repository/Apps/Images/green_icon.png'
ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Stereo Systems' THEN 'IBFS:/WFC/Repository/Apps/Images/green_icon.png'
ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Televisions' THEN 'IBFS:/WFC/Repository/Apps/Images/green_icon.png'
ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Video Production' THEN 'IBFS:/WFC/Repository/Apps/Images/green_icon.png' ELSE '';
ICON/A500V='<IMG SRC="'||ICON_PATH||'" width=28px height=28px>';
END
TABLE FILE WF_RETAIL
SUM
     WF_RETAIL.WF_RETAIL_SALES.REVENUE_US
BY  WF_RETAIL.WF_RETAIL_PRODUCT.ICON_PATH
BY  WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY
BY  LOWEST WF_RETAIL.WF_RETAIL_SALES.SALE_UNITY
WHERE RECORDLIMIT EQ 1000
WHERE READLIMIT EQ 1000
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,
$
TYPE=DATA,
     COLUMN=N1,
     IMAGE=(ICON_PATH),
	 SIZE=(.3 .3),
$
ENDSTYLE
END



Any one attempted this scenario.?

This message has been edited. Last edited by: FP Mod Chuck,


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
March 05, 2019, 04:21 AM
Wep5622
It looks like you should be able to do that using conditional styling, where you define one image and condition for each PRODUCT_CATEGORY.

ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,
$
TYPE=DATA, COLUMN=N1,$ Default case
TYPE=DATA, COLUMN=N1, IMAGE=('IBFS:/WFC/Repository/Apps/Images/green_icon.png'), SIZE=(.3 .3),
 WHEN=PRODUCT_CATEGORY EQ 'Accessories',$
TYPE=DATA, COLUMN=N1, IMAGE=('IBFS:/WFC/Repository/Apps/Images/green_icon.png'), SIZE=(.3 .3),
 WHEN=PRODUCT_CATEGORY EQ 'Camcorder',$
TYPE=DATA, COLUMN=N1, IMAGE=('IBFS:/WFC/Repository/Apps/Images/green_icon.png'), SIZE=(.3 .3),
 WHEN=PRODUCT_CATEGORY EQ 'Computers',$

etc.

ENDSTYLE
END



WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
March 05, 2019, 06:30 AM
Tony A
You should be able to achieve both HTML and PDF outputs using the following (I've used images on my install so they may/may not be on yours) -

DEFINE FILE WF_RETAIL
ICON_PATH/A100V = IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Accessories'      THEN 'C:\ibi\AppStudio82\webapps\webfocus\activereports\distribution\images\irbcomment.png'
             ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Camcorder'        THEN 'C:\ibi\AppStudio82\webapps\webfocus\activereports\distribution\images\irbfltg.png'
             ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Computers'        THEN 'C:\ibi\AppStudio82\webapps\webfocus\activereports\distribution\images\irblock.png'
             ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Media Player'     THEN 'C:\ibi\AppStudio82\webapps\webfocus\activereports\distribution\images\irbhrglss.png'
             ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Stereo Systems'   THEN 'C:\ibi\AppStudio82\webapps\webfocus\activereports\distribution\images\irbunlock.png'
             ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Televisions'      THEN 'C:\ibi\AppStudio82\webapps\webfocus\activereports\distribution\images\irbline.png'
             ELSE IF WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY EQ 'Video Production' THEN 'C:\ibi\AppStudio82\webapps\webfocus\activereports\distribution\images\irbscattr.png' ELSE '';
END
TABLE FILE WF_RETAIL
SUM 
     WF_RETAIL.WF_RETAIL_SALES.REVENUE_US
BY  ICON_PATH
BY  WF_RETAIL.WF_RETAIL_PRODUCT.PRODUCT_CATEGORY
BY  WF_RETAIL.WF_RETAIL_SALES.SALE_UNITY
WHERE RECORDLIMIT EQ 1000
WHERE READLIMIT EQ 1000
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET BYDISPLAY ON
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty,
$
TYPE=DATA,
     COLUMN=N1,
     IMAGE=(ICON_PATH),
     SIZE=(0.291667 0.291667),
$
ENDSTYLE
END


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
March 05, 2019, 08:34 AM
srajeevan
@Tony & @Wep5622,
Thanks for the examples.
I am able to get the images in PDF.The code i posted also does that.
But what i am trying to do is, append REVENUE_US along with the ICON.
I am able to append that in HTML using define.But in PDF output format i am not able to do that.
Sorry for not being clear earlier.


WF8206,Windows 7,8,10
HTM,PDF,EXCEL
March 05, 2019, 09:16 AM
Tony A
Even in HTML the image is a seperate object and not merged (as you seem to imply) except from the viewpoint that they could be contained within the same tabular cell (<TD> element).

A PDF stream doesn't really have the same construct as HTML output so, no, you can't do that.


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
March 05, 2019, 10:03 AM
srajeevan
Hi Tony,

Thanks for clarifying.
In HTML i append image to the value as shown below.
The define field Def_IMAGECONCAT will have image and value as a column.

  
BASE_PATH/A500V ='WFServlet.ibfs?IBFS1_action=RUNFEX&|IBFS_path=/WFC/Repository/Apps/Images/';
ICON_PATH/A500V = IF Def_ROW EQ 'Percent Change' AND SaleCount GT 0 THEN BASE_PATH || 'green_icon.png' ELSE IF Def_ROW EQ 'Percent Change' AND SaleCount LT 0 THEN BASE_PATH || 'red-icon.png';
ICON/A500 = '<IMG SRC="'||ICON_PATH||'" width=10px height=10px>';
Def_IMAGECONCAT/A600V = IF Def_ROW EQ 'Percent Change' AND SaleCount GT 0 THEN ICON|' '|FPRINT(SaleCount,'D12.2','A100') ELSE IF Def_ROW EQ 'Percent Change' AND SaleCount GT 0 THEN ICON|' '|FPRINT(SaleCount,'D12.2','A100') ELSE FPRINT(SaleCount,'D20','A100');




WF8206,Windows 7,8,10
HTM,PDF,EXCEL
March 05, 2019, 10:04 AM
Tony A
quote:
append image to the value

They are still two seperate objects!

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10