Hi i have a system task that runs every 60 seconds.
this processes a piece of code, this code downloads emails with csv
attachments and saves the attachment to my server
then my code goes through the csv file and inserts each row into an array.
i then insert the array into my table.
some of the inserts are only getting 3/4 of the way through the csv file (not
inserting the full csv content into my table).
could this be a time out ?
if so how can this be fixed?
<cfset columncount = 7>
<cffile action="read" file="#currentdir#/#GetUser.Match#.csv"
variable="datafile">
<cfset counter = 1>
<cfloop index="datarec" list="#datafile#" delimiters="#chr(13)#">
<cfif counter gt 1>
<cfset dataArray = ListToArray(datarec,chr(44))>
<cfif ArrayLen(dataArray) eq columncount >
<cfquery name="INSERT" datasource="#application.ds#">
insert into sms_players_table
(Surname, FirstName, Phone, Group, Class, App_ID, ClubID)
values
('#dataArray[1]#','#dataArray[2]#','#dataArray[3]#','#dataArray[4]#','#dataArray
[5]#','#dataArray[6]#',#getuser.clubID#)
</cfquery>
<cfelse>
column count not macthed
</cfif>
</cfif><cfset counter = counter + 1>
</cfloop>
Dan Bracuk - 30 Aug 2007 13:41 GMT
You can increase the timeout with the cfsetting tag.
KeithLaw999 - 30 Aug 2007 14:37 GMT
ok thanks,
but would timeout be the reason ?
how can i test to see what the acual error is,
Dan Bracuk - 30 Aug 2007 17:30 GMT
read whatever files errors get written to.
KeithLaw999 - 30 Aug 2007 19:06 GMT
yes but i can not see the error as this is a system task, what code could i add to send me a email with the actual error?
Dan Bracuk - 30 Aug 2007 22:37 GMT
cftry/cfcatch might work.
Azadi - 31 Aug 2007 03:18 GMT
have you tired increasing the interval your task runs at? i.e. set it to
run every 5 minutes instead of every 60 seconds...
as suggested, put your code inside a cftry/cfcatch block and have
cfcatch email you any errors...

Signature
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Grizzly9279 - 31 Aug 2007 05:40 GMT
Are you running this via the CF-scheduler? If so, check your scheduler.log
Alternatively, you can also check your application.log for errors.
Alternatively, adding a quick <cferror> tag might help you debug it:
<cferror type="exception" template="showError.cfm" mailTo="me@domain.com">