Focal Point
[SOLVED]Trouble Attaching Excel report to email through report caster

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

April 04, 2017, 11:44 AM
manglum
[SOLVED]Trouble Attaching Excel report to email through report caster
I created an export of a report in excel (XLSX)format to distribute via email through a report caster job. I was able to set up the report caster job to attach this file to the email and send it.

I went back and redesigned that extract into a compound report (data on multiple tabs of the excel workbook). Now the file will no longer attach to the email from the report caster job. The .fex name remains the same as before. Below is the procedure that creates the excel file. I am using the OPEN and CLOSE commands to accomplish putting the data on the different tabs of the workbook.

 -TYPE *** IBFS:/WFC/Repository/eongou02/std_reports/reportsdevel/DailyShrinkFlash/Daily_Blended_File_Doug *** &DATEMtDY &TOD *** Start
-SET &ExecedFrom = 'Report' ;
-INCLUDE IBFS:/WFC/Repository/eongou02/std_reports/reportsdevel/DailyShrinkFlash/Daily_Shrink_Recap_File_Checking.fex
-SET &ECHO = 'ALL' ;
-DEFAULT &DIVISION = 99
-SET &FileTitle = IF &DIVISION.EVAL EQ 99 THEN 'Daily Shrink Recap, Total Company' ELSE 'Daily Shrink Recap, Division ' | &DIVISION ;
-SET &ECHO = 'OFF' ;
-TYPE *** &|FileTitle  = &FileTitle  ***
-SET &ECHO = 'ALL' ;
SET NODATA = ' '
DEFINE FILE EBRRPT_RPT_DAILY_BLENDED_SHRINK_SUMMARY_TBL
TYRATE/D7.2%=TYRATE*100;
LYRATE/D7.2%=LYRATE*100;
OPTRATE/D7.2%=OPTRATE*100;
GAPCL/D7.2%=GAPCL*100;
RDFCST/D7.2%=RDFCST*100;
END

TABLE FILE EBRRPT_RPT_DAILY_BLENDED_SHRINK_SUMMARY_TBL
PRINT
INVENTORY/MDYY AS 'DATE'
TYSHRINK/D10CBM AS 'TY ,SHRINK'
TYSALES/D10CBM AS 'TY ,SALES'
TYRATE AS 'TY ,SHRINK ,%'
STATUS
LYSHRINK/D10CBM AS 'LY ,SHRINK'
LYSALES/D10CBM AS 'LY ,SALES'
LYRATE AS 'LY ,SHRINK ,%'
VARBPS/D10CB AS 'VAR'
OPTDLLRS/D10CBM AS 'OPTIMIZED ,$'
OPTRATE AS 'OPTIMIZED ,%'
VARTOOPT/D10CB AS 'VAR ,TO ,OPTIMIZED'
GAPCL AS 'GAP ,CLOSURE'
RDFCST AS 'RD ,FCST'
FINPDPOSTED AS 'POST ,PERIOD'
COHORT
IMPROVED AS 'IMPRVD'
TSS
FINQTRPOSTED AS 'QTR'
FLAG AS 'HSAP'
POSTING AS 'POST ,DATE'
FINWKPOSTED AS 'FIN ,WK'
-IF &DIVISION.EVAL EQ 99 THEN GOTO SHOWALLREG;
WHERE SDIV EQ &DIVISION.EVAL
-SHOWALLREG
WHERE STATUS EQ 'Rec'
BY LOWEST SDIV AS 'DIV'
BY LOWEST REGION AS 'REG'
BY LOWEST DISTRICT AS 'DIS'
BY LOWEST LOCID AS 'STORE'
-*ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET BYDISPLAY ON
-*ON TABLE NOTOTAL
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,$
TYPE=REPORT,FONT='CALIBRI',SIZE=9,COLOR=RGB(66 70 73),STYLE=NORMAL,JUSTIFY=CENTER,TITLETEXT=Stores,$
ENDSTYLE
ON TABLE PCHOLD AS '&FileTitle.EVAL' FORMAT XLSX OPEN
END





DEFINE FILE EBRRPT_RPT_DAILY_BLENDED_SHRINK_SUMMARY_DISTRICT_TBL
TYRATE/D7.2%=TYRATE*100;
LYRATE/D7.2%=LYRATE*100;
OPTRATE/D7.2%=OPTRATE*100;
GAPCL/D7.2%=GAPCL*100;
RDFCST/D7.2%=RDFCST*100;
TYOPTRATE/D7.2%=TYOPTRATE*100;
END

TABLE FILE EBRRPT_RPT_DAILY_BLENDED_SHRINK_SUMMARY_DISTRICT_TBL
PRINT
TYSHRINK/D10CBM AS 'TY ,SHRINK'
TYSALES/D10CBM AS 'TY ,SALES'
TYRATE AS 'TY ,SHRINK ,%'
LYSHRINK/D10CBM AS 'LY ,SHRINK'
LYSALES/D10CBM AS 'LY ,SALES'
LYRATE AS 'LY ,SHRINK ,%'
VARBPS/D10CB AS 'VAR'
OPTDLLRS/D10CBM AS 'OPTIMIZED ,$'
TYOPTRATE AS 'OPTIMIZED ,%'
VARTOOPT/D10CB AS 'VAR ,TO ,OPTIMIZED'
GAPCL AS 'GAP ,CLOSURE'

-IF &DIVISION.EVAL EQ 99 THEN GOTO SHOWALLDIS;
WHERE SDIV EQ &DIVISION.EVAL
-SHOWALLDIS
BY LOWEST SDIV AS 'DIV'
BY LOWEST REGION AS 'REG'
BY LOWEST DISTRICT AS 'DIS'
-*ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET BYDISPLAY ON
-*ON TABLE NOTOTAL

ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,$

TYPE=REPORT,FONT='CALIBRI',SIZE=9,COLOR=RGB(66 70 73),STYLE=NORMAL,JUSTIFY=CENTER,TITLETEXT=District,$
ENDSTYLE
ON TABLE PCHOLD AS '&FileTitle.EVAL' FORMAT XLSX
END




DEFINE FILE EBRRPT_RPT_DAILY_BLENDED_SHRINK_SUMMARY_REGION_TBL
TYRATE/D7.2%=TYRATE*100;
LYRATE/D7.2%=LYRATE*100;
OPTRATE/D7.2%=OPTRATE*100;
GAPCL/D7.2%=GAPCL*100;
RDFCST/D7.2%=RDFCST*100;
TYOPTRATE/D7.2%=TYOPTRATE*100;
END

TABLE FILE EBRRPT_RPT_DAILY_BLENDED_SHRINK_SUMMARY_REGION_TBL
PRINT
TYSHRINK/D10CBM AS 'TY ,SHRINK'
TYSALES/D10CBM AS 'TY ,SALES'
TYRATE AS 'TY ,SHRINK ,%'
LYSHRINK/D10CBM AS 'LY ,SHRINK'
LYSALES/D10CBM AS 'LY ,SALES'
LYRATE AS 'LY ,SHRINK ,%'
VARBPS/D10CB AS 'VAR'
OPTDLLRS/D10CBM AS 'OPTIMIZED ,$'
TYOPTRATE AS 'OPTIMIZED ,%'
VARTOOPT/D10CB AS 'VAR ,TO ,OPTIMIZED'
GAPCL AS 'GAP ,CLOSURE'

-IF &DIVISION.EVAL EQ 99 THEN GOTO SHOWALL;
WHERE SDIV EQ &DIVISION.EVAL
-SHOWALL
BY LOWEST SDIV AS 'DIV'
BY LOWEST REGION AS 'REG'
-*ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET BYDISPLAY ON
-*ON TABLE NOTOTAL

ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,$

TYPE=REPORT,FONT='CALIBRI',SIZE=9,COLOR=RGB(66 70 73),STYLE=NORMAL,JUSTIFY=CENTER,TITLETEXT=Region,$
ENDSTYLE
ON TABLE PCHOLD AS '&FileTitle.EVAL' FORMAT XLSX CLOSE
END







-RUN
-SET &ECHO = 'OFF' ;
-TYPE *** &RECORDS Records &LINES lines ***
-TYPE *** IBFS:/WFC/Repository/eongou02/std_reports/reportsdevel/DailyShrinkFlash/Daily_Blended_File_Doug *** &DATEMtDY &TOD *** Ended
 

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


WebFOCUS 8
Windows, All Outputs
April 05, 2017, 08:31 AM
Emily Max
Hello,
You are missing the OPEN on your second report.
Have a great day,
Emily


WF 8.1.05 on Windows machines
Backend: Informix, SQL and Oracle databases
April 05, 2017, 08:38 AM
Tom Flynn
OPEN is not needed on 2nd report.
Need to FILEDEF and APPEND.


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
April 05, 2017, 09:36 AM
manglum
quote:
Originally posted by Tom Flynn:
OPEN is not needed on 2nd report.
Need to FILEDEF and APPEND.


Thank you Tom. I was thinking that the OPEN was only needed on the first report.

Can you please elaborate on where and how to use the FILEDEF and APPEND?


WebFOCUS 8
Windows, All Outputs
April 05, 2017, 10:25 AM
manglum
quote:
Originally posted by Tom Flynn:
OPEN is not needed on 2nd report.
Need to FILEDEF and APPEND.


Also, is this going to try and append my 3 reports into 1? I still want each of my reports to live on a different tab in the XLSX file. thanks!


WebFOCUS 8
Windows, All Outputs
April 05, 2017, 01:01 PM
jcannavo
Hello,

One thing you could try is to override the format within the caster schedule. Open the schedule and edit your task (which should be calling your FEX). Within there you should find Report Properties, try checking the box that says "Override the Format Specified in the Procedure" and choose EXL07.

For some reason I think once upon a time I had to do that for a report to work. Just something to try.


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
April 05, 2017, 01:34 PM
manglum
quote:
Originally posted by jcannavo:
Hello,

One thing you could try is to override the format within the caster schedule. Open the schedule and edit your task (which should be calling your FEX). Within there you should find Report Properties, try checking the box that says "Override the Format Specified in the Procedure" and choose EXL07.

For some reason I think once upon a time I had to do that for a report to work. Just something to try.


Well, that worked!

I'd like to understand more about that so I knew why it was needed. But I'll take the win :-)


WebFOCUS 8
Windows, All Outputs
April 05, 2017, 02:21 PM
jcannavo
And I wish I could explain why it is needed, but I'm not entirely sure either Smiler. It's as if compounding the report confuses the scheduler as far as the file-type is concerned coming from the FEX. Maybe someone else perusing this request may be able to explain it better.

I just recall once with a compound report having an issue and trying the override and it worked. Glad that worked for you as well. If it is indeed working and fixed, please update your original post and add [Solved] to the title.


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
April 06, 2017, 12:21 PM
jgelona
Unless you change the default, Caster output HTML, you always have to override the output format if it is not HTML.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.