Beginners query - using output [Archive] - ProgressTalk.com
Google
 
Web ProgressTalk.com

View Full Version : Beginners query - using output



mossvector
20 Mar 2005, 09:18 AM
Hi,



Have just completed my first ever Progress script, but was wondering if anyone could help with a few neat finishing touches?



At the moment I am using:



output to "C:\temp\query.log".

<Query>

output close.



To write a report to a file. What I would really like it to do, is write to a file, and include the date within the file name. Also, before writing the file – I would like it to check if a file by the same name already exists, if it does – then for the code to stop, and not overwrite the existing file.



I’m not sure how to determine the system date, check whether a file already exists and have so far been unable to build an output path with variables.



Any pointers would be very much appreciated!



Thanks

Steve

jongpau
20 Mar 2005, 01:36 PM
Hi,

Try something like this:
DEF VAR vFile AS CHAR NO-UNDO.
vFile = "ReportName":U + STRING(TODAY,"99-99-9999":U) + ".txt":U.
IF SEARCH (vFile) EQ ?
THEN DO:
OUTPUT TO VALUE(vFile) PAGE-SIZE 0.
<QUERY>
OUTPUT CLOSE.
END. Good luck :)

mossvector
20 Mar 2005, 01:41 PM
Hi Paul,

Won't be able to try it until tomorrow - but thanks for that!

Thanks
Steve