yup, you're overwriting the function here: fixedDate = CreateODBCDate(Now());
fix this by chaging to this: var fixedDate = CreateODBCDate(Now()); and get in the habit of not using variables with identical names to the function whithin the function. > -----Original Message----- > From: David Phipps [mailto:[EMAIL PROTECTED]] > Sent: 03 February 2003 16:03 > To: [EMAIL PROTECTED] > Subject: RE: [ cf-dev ] UDF problem > > > The function is pretty basic and I can't see that it is overwriting > itself. All it does is takes a date field and flips it > around to give a > nice ODBC date. > > The udf code is below: > > <cfscript> > /** > * Parses the UK formatted date string and converts it to an > ODBCDate. > * > * @param date2fix The date to correctly format for ODBC. > * @return Returns an ODBC formatted date. > * @author Dave Phipps ([EMAIL PROTECTED]) > * @version 1, January 7, 2003 > */ > function fixedDate(date2fix) > { > if (LSIsDate(date2fix)) > if (ListLen(date2fix, "/.-") EQ 3) { > day = ListGetAt(date2fix, 1, "/,.-"); > month = ListGetAt(date2fix, > 2, "/,.-"); > year = ListGetAt(date2fix, > 3, "/,.-"); > date = "#month#/#day#/#year#"; > fixedDate = CreateODBCDate(date); } > else > fixedDate = CreateODBCDate(Now()); > else > fixedDate = CreateODBCDate(Now()); > return fixedDate; > } > </cfscript> > > Am I overwriting the fixedDate() function in the above code? > > Thanks > > Dave > > At 15:58 03/02/2003 +0000, you wrote: > >Are you overwriting the variable caller.fixeddate within the > function? That > >would certainly cause the function to break. > > > >The function does have access to the variables in the calling page. > > > >Paul > >------------------------------------------- > >Paul Johnston > >PJ Net Solutions Ltd > >http://www.pjnetsolutions.com > >[EMAIL PROTECTED] > >+44 (0)7866 573013 > > > > > > > -----Original Message----- > > > From: David Phipps [mailto:[EMAIL PROTECTED]] > > > Sent: 03 February 2003 15:50 > > > To: [EMAIL PROTECTED] > > > Subject: RE: [ cf-dev ] UDF problem > > > > > > > > > Definitely not overwriting it as the two queries are called > > > directly after > > > one another. The whole section of code is below: > > > > > > <cfif attributes.noPressRelease EQ 0> > > > <!--- Update the releaseManager table with the > > > release to press > > > dates and times ---> > > > <cfquery name="updateReleaseManagerPress" > > > datasource="#request.dsn#" dbtype="ODBC"> > > > UPDATE releaseManager > > > SET releaseDate = <cfif > > > attributes.immediateRelease EQ 1 > > > AND attributes.isReleased NEQ 1><cfqueryparam > cfsqltype="CF_SQL_DATE" > > > value="#Now()#"><cfelse><cfqueryparam cfsqltype="CF_SQL_DATE" > > > value="#fixedDate(attributes.releaseDate)#"></cfif>, > > > releaseTime = <cfqueryparam > > > cfsqltype="CF_SQL_TIME" value="#attributes.releaseTime#">, > > > immediateRelease = > > > #attributes.immediateRelease#, > > > releasedBy = > > > '#session.currentuser.realname#', > > > processedDate = <cfqueryparam > > > cfsqltype="CF_SQL_DATE" value="#Now()#">, > > > isReleased = 1 > > > WHERE releaseid = '#attributes.releaseid#' > > > </cfquery> > > > </cfif> > > > > > > <cfif attributes.webRelease EQ 1> > > > <!--- Update the releaseManager table with web release info ---> > > > <cfquery name="updateReleaseManagerWeb" > datasource="#request.dsn#" > > > dbtype="ODBC"> > > > UPDATE releaseManager > > > SET webRelease = #attributes.webRelease#, > > > webDate = <cfif attributes.webDate IS NOT > > > ""><cfqueryparam cfsqltype="CF_SQL_DATE" > > > value="#fixedDate(attributes.webDate)#"><cfelse><cfqueryparam > > > cfsqltype="CF_SQL_DATE" value="#Now()#"></cfif> > > > WHERE releaseid = '#attributes.releaseid#' > > > </cfquery> > > > </cfif> > > > > > > So unless the cfqueryparam tag is clearing the fixedDate() > > > function then I > > > can't see why it works in the first query and not in the second. > > > > > > As you can see there is nothing happening between the first > > > call and second > > > call to the function that would reset it or is there? Am I > > > missing something? > > > > > > Thanks > > > > > > Dave > > > > > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > For human help, e-mail: [EMAIL PROTECTED] > -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
