Beginners query - using output

mossvector

New Member
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
 
Hi,

Try something like this:
Code:
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 :)
 
Back
Top