Focal Point
filename with the current date in it

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

December 06, 2004, 01:04 PM
<geetha>
filename with the current date in it
Hi all,

I have to send an excel file using report caster ftp option and the name of the file, I am sending should have the current date in it everyday. for example today,it should be report-2004-12-06.xls.

Please help me if some one out there has done like this.
December 06, 2004, 02:15 PM
TexasStingray
geetha,

One way to do this would be to have another focexec procedure that create a distribution file. This file would have to be stored/updated where the report caster server could find it. This procedure should be schedule with report caster and then if Report Caster and the WebFOCUS Reporting Server are on the same box just save it to the local drive where caster could find it else you could ftp it where caster could find it for the Real Job. This procedure must be ran before the Real Job so that caster see's the new name. Hope this helps.
December 06, 2004, 04:05 PM
<geetha>
Hi TexasStingray,

Thank you for your suggestions. I was looking into the report caster documentation, it says that we can have dynamic address list as follows.

Dynamic Address. You can select a dynamic address list by clicking the Choose address button . A dynamic address list enables you to return in memory either a list of burst values and destinations, or only a list of destinations from a data source (for example, a flat file, SQL database, FOCUS data source, or LDAP). You must code a FOCUS procedure (FOCEXEC) that is available to the path of the server defined in either the server's profile (edasprof.prf) or the user's profile. The procedure must return the distribution information (using the PCHOLD command) with the data in a specific layout that you define. This layout must contain specific values and destinations so that ReportCaster can identify and process the information returned.

The following is a sample Master File for FTP distribution information located in a text file.


FILE=MYADDR ,SUFFIX=FIX
SEGNAME=SEG01 ,SEGTYPE=S02
FIELDNAME =BURST_VALUE ,BURST ,A50 ,A50,$
FIELDNAME =FTP_FILENAME ,FTP ,A40 ,A40,$


The following is a sample request (procedure) for bursting. The column names and the order in which they are returned must be 'VALUE' and then 'DEST'.


SET ASNAMES=ON;
TABLE FILE MYADDR
PRINT BURST_VALUE AS 'VALUE'
FTP_FILENAME AS 'DEST'
ON TABLE PCHOLD
END


The following is a sample request (procedure) for non-bursting. In this case, the 'VALUE' column does not need to be provided since bursting is not required.


SET ASNAMES=ON;
TABLE FILE MYADDR
PRINT FTP_FILENAME AS 'DEST'
ON TABLE PCHOLD
END

Note: If the column names are not VALUE and DEST, you must add a SET ASNAMES=ON; qualifier before the TABLE FILE statement.

So according to that, can I replace FTP_FILENAME in the text file with the filename and concate the date variable in it.

Thanks,
Geetha
December 06, 2004, 04:18 PM
Spence
See if this works for you.

-SET &TODAY = &MDYY;
-SET &NAME1 = 'RPT'||&TODAY;
-SET &NAME2 = &NAME1||'.XLS';
FILEDEF &NAME1 DISK c:\ibi\apps\samples\&NAME2
-***
TABLE FILE CAR
SUM SALES
BY COUNTRY
ON TABLE SAVE AS &NAME1 FORMAT EXL2K
END
December 06, 2004, 04:45 PM
TexasStingray
According to what you have posted Try Something like this.

-SET &TODAY = EDIT(&YYMD, '9999-99-99');

SET ASNAMES = ON

DEFINE FILE CAR
FTPLOC/A40 = '/localhost/reports/report-' | '&TODAY' | '.xls';
END

TABLE FILE CAR
PRINT FTPLOC AS 'DEST'
BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE PCHOLD
END
December 06, 2004, 05:41 PM
susannah
go with Spence's answer.
December 06, 2004, 06:42 PM
<geetha>
Thank you so much,

you guys solved my problem. I am fairly new to IBI web focus, and trying to learn.

I appreciate your quick responses!!!