May 11, 2005, 01:34 PM
<Mirza>Appending data from a series of different files
Hello,
I am trying to have my report read information from a series of files with a loop statment. The only problem is I'm not sure how to impliment a proper loop on a report whose paramater (to read a file) is a DATE and is constantly changing? Please see below for an example of this.
-*Loop 7 times (this will be a parameter for the user to enter)
-DEFAULT &FILE_NAME=20050504
-*The filenames are (20050504, 20050505, 20050506, etc.. up to the number of times looped - in this case it would there are 7 files to be read (up to 20050511))
-*Since the filename is a date, is there a way for WebFOCUS can understand to add days in case of an end of month scenario? (i.e. 20050426 + 7 loops =20050503)?
FILEDEF DATA_FILE DISK /stage/ftpdata/&FILE_NAME
APP HOLD TEMP
FILEDEF REQHOLD DISK C:\IBI\APPS\TEMP\REQHOLD.FTM (APPEND
TABLE FILE DATA_FILE
PRINT *
ON TABLE HOLD AS REQHOLD
END
-*REPEAT LOOP
-*PRINT EVERYTHING IN THE HOLD FILE
TABLE FILE REQHOLD
PRINT *
END
Any help will be appreciated!
Thanks.
May 11, 2005, 02:06 PM
<JG>Use the AYMD function as follows
-SET DATE='20050526';
-SET &COUNTER=-1;
-REPEAT ENDREPEAT 7 TIMES
-SET &COUNTER=&COUNTER+1;
-SET &NEWDATE=AYMD(&DATE.EVAL,&COUNTER,'I8');
-TYPE NEW DATE IS &NEWDATE
-ENDREPEAT
May 11, 2005, 02:30 PM
<Mirza>Hi JG,
WOW that code worked like a charm!
Thanks!