Focal Point
[CLOSED] Email and Create a copy of the report in a network folder

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

March 09, 2012, 05:07 AM
SriAravind
[CLOSED] Email and Create a copy of the report in a network folder
I had scheduled a job in report caster which was intend to send the report in an email. But in addition i should create a copy of that report in a network drive folder also.

So while scheduling i would select the distribution format as email which will send an email. But how do i create a copy of the report in network drive. If the report exists already, it should overwrite that. Can anyone post the sample code for the same.

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


WebFocus Version 7.7.05
Windows, HTML/PDF/EXL2K/AHTML
March 13, 2012, 08:47 AM
jgelona
Unless someone knows a different way, the portion of the job that produces the report has to run twice, first to a file, second for email, then depending on your environment, ftp/copy the file to the desired folder.

Code would look something like this:
-SET &PASS=0;
-REPEAT ENDLOOP 2 TIMES
-SET &HOLD=IF &PASS EQ 0 THEN 'HOLD AS RPT1' ELSE 'PCHOLD';
 TABLE FILE CAR
 PRINT *
 ON TABLE &HOLD FORMAT EXL2K
 END
? FILEDEF
-RUN
-SET &PASS=&PASS+1;
-ENDLOOP
-*
-*  FTP/COPY FILE TO FOLDER
-*
   execute OS command(s) to place file in the desired folder

The ? FILEDEF is to get the filename so after you have it, it can be removed.

What we do is just produce the report in a file, ftp to the folder, put a link to the report on our dashboard. Saves on email traffic.

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


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
March 14, 2012, 03:40 PM
linus
I email/ftp my reports in one pass. Hope this helps.

  
-*set an &var to desired file name
-SET &EFILE='CAR.xls';
-*filedef the file
APP FI CAR DISK &EFILE
-RUN

-** CREATE REPORT
TABLE FILE CAR 
PRINT *
ON TABLE HOLD AS CAR FORMAT EXL2K
END

-*send email
-*get edatemp directory and concatenate to 
-* file name.
-SET &ARGLEN = ARGLEN(120,TEMPPATH(120,'A120'),'I2')+1;
-SET &TP    = TEMPPATH( &ARGLEN, 'A&ARGLEN.EVAL') || '&EFILE.EVAL';

-*set &var for email address
-SET &EADDR1 = 'mmouse@disneyland.com';

-** make call to javamail to email report
! /opt/java6/jre/bin/java SendFileWithAuth &EADDR1 &TP.EVAL "Car Rpt Attached" "Car Rpt"

-** SQL Stored Procedure to FTP file to web server.
-FTP_FILE

ENGINE SQLMSS SET DEFAULT_CONNECTION SQLDBname
-RUN

SQL SQLMSS
EX MSDB.dbo.sp_start_job N'FTPGetCarRpt'
END
-EXIT



WF 7.7.05
HP-UX - Reporting Server, Windows 2008 - Client, MSSQL 2008, FOCUS Databases, Flat Files
HTML, Excel, PDF