1 Reply Latest reply on Aug 26, 2008 11:06 AM by Libby H

    cfschedule issues, please help

    CFmonger Level 1
      Hello;
      I am trying to set up a cfschedule for part of my app. It has a number of different function, so I am trying to build them one at a time.

      The first part I am trying to do it to get an export to excel to function automatically on a weekly basis, I have been writting the code, and setting it for like 5 min after I post it to see if it works, and it isn't posting a file to the directory I am specifying.

      This is my code:

      <cfschedule action = "run"
      task = "spreadsheet"
      startDate = "6/13/08"
      startTime = "4:15 PM"
      interval = "weekly"
      resolveURL = "no"
      publish = "Yes"
      file = "report.xls"
      path = "c:\websites\4npp8b\admin\trac\excel"
      requestTimeOut = "600">

      <cfsetting enablecfoutputonly="yes">

      <cfquery NAME="tracking" datasource="#APPLICATION.dataSource#">
      SELECT ID, REMOTE_ADDR, HTTP_USER_AGENT, TRACK_DATE, PATH_INFO
      FROM tracking
      ORDER BY ID
      </cfquery>

      <cfset tabChar = chr(9)>
      <cfset newLine = chr(13) & chr(10)>

      <cfcontent TYPE="application/msexcel" file="c:\websites\4npp8b\admin\trac\excel">
      <cfheader name="content-disposition" value="attachment;filename=report.xls">

      <cfoutput>REMOTE ADDRESS#tabChar#Browser#tabChar#Date#tabChar#Entry Page#newLine#</cfoutput>

      <cfloop query="tracking">
      <cfoutput>#REMOTE_ADDR##tabChar##HTTP_USER_AGENT##tabChar##TRACK_DATE##tabChar##PATH_INFO# #newLine#</cfoutput>
      </cfloop>
      </cfschedule>

      I know the excel code works, I tried it off a link before I tried to automate it, then added the file feature to the cfcontent tag.

      I believe this is the way it is supposed to be done, I have been reading it from cfdocs. What am I doing wrong? Any idea? Can anyone help me fix this?

      Thank you