This is your most reliable option (CFschedule is flaky).

At the top of the page that displays the report (report.cfm) put this line:

------------------------------------
<cfset today = dateFormat(now(),"mm_dd_yy")>
<cfset fileName = "#expandPath("./")#/report_#today#.htm">

<cfif NOT fileExists("#fileName#")>
        <!--- query --->
        <!--- loop through the query and create a string representing the
entire HTML report--->
        <cffile action="write" file="#fileName#" output="#htmlString#">
        <cflocation url="report.cfm">
</cfif>

<cfinclude template="report_#today#.htm">
------------------------------------

You may experience problems with the file not being registered with the file
system after creating it the first time.  This may lead to the page looping
2 or 3 times before it realizes the file exists.  If this happens just
remove the cflocation and put a META refresh on the page with a message like
"loading report...".  Give it a 5 second reload time and you'll be set.

This way the html report will be created fresh the first time it is called
each day.

+-----------------------------------------------+
Bryan Love
  Macromedia Certified Professional
  Internet Application Developer
  Database Analyst
Telecommunication Systems
[EMAIL PROTECTED]
+-----------------------------------------------+

"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
        - Thomas Paine, The American Crisis



-----Original Message-----
From: Paul Ihrig [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 2:35 PM
To: CF-Talk
Subject: output cf to html


I have this Huge Honking report....
written in cf

it shows exactly what i want.

but i don't want a user to run this report every time they hit the page.

i would like to know how to
have cf-server
run the page...
but just save it to html
every night.

so that it gets updated basically once a day.
instead of hitting the db every time some one views the cfm page..

any ideas?

-paul

______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to