tested it, and yes, thats perhaps what you're doing...

I used this:

<cfscript>
        function fixdate(date) {
                fixdate = dateformat(date, "dd/mm/yy");
                return fixdate;
        }
</cfscript>

<cfoutput>#fixdate(now())#<br>#fixdate(now())#</cfoutput>

If you do the following you'll fix it:

<cfscript>
        function fixdate(date) {
                var fixdate = dateformat(date, "dd/mm/yy");
                return fixdate;
        }
</cfscript>

ie stick 'var' in front of the first reference to the new variable
'fixdate', this internalises the variable ensuring that its not used outside
of the function and doesn't overwrite any variables outside of it -
identical to javascript.

> -----Original Message-----
> From: Rich Wild [mailto:[EMAIL PROTECTED]]
> Sent: 03 February 2003 15:49
> To: '[EMAIL PROTECTED]'
> Subject: RE: [ cf-dev ] UDF problem
> 
> 
> perhaps you're overwriting the function from within the 
> function? Don't know
> if that could happen, I'll give a whirl now...
> 
> > -----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
> > 
> > At 15:38 03/02/2003 +0000, you wrote:
> > > > is it possible you're overriding the function name somewhere?
> > >
> > >Suggestion on this front is to put all your functions in a 
> structure
> > >somewhere that won't get overwritten, something like 
> > "function" and then
> > >call it via:
> > >
> > >Function.webdate(date)
> > >
> > >You can put functions into the request scope too, and that 
> makes them
> > >available over all custom tags.
> > >
> > >As is said above, check you aren't overwriting "fixeddate" 
> parameter
> > >anywhere.
> > >
> > >Paul
> > >
> > > > > -----Original Message-----
> > > > > From: David Phipps [mailto:[EMAIL PROTECTED]]
> > > > > Sent: 03 February 2003 15:30
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: [ cf-dev ] UDF problem
> > > > >
> > > > >
> > > > > Hi,
> > > > >
> > > > > I have a page that is running two update queries and both
> > > > > make use of a UDF
> > > > > which is cfincluded in the Application.cfm
> > > > >
> > > > > The first query uses the function and updates the db with no
> > > > > problem but
> > > > > the second call to the function thrwows the following error:
> > > > >
> > > > > Error Diagnostic Information
> > > > >
> > > > > An error occurred while evaluating the expression:
> > > > >
> > > > >
> > > > > "#fixedDate(attributes.webDate)#"
> > > > >
> > > > > Error near line 56, column 95.
> > > > >
> > > > > The symbol you have provided (fixedDate) is not the name of a
> > > > > function...
> > > > >
> > > > > Why am I able to call the function the first time and then
> > > > > not a second time?
> > > > >
> > > > > Is this a bug with UDF's?
> > > > >
> > > > > The two queries look like:
> > > > >
> > > > > This one works:
> > > > >
> > > > > <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>
> > > > >
> > > > > This throws the error:
> > > > >
> > > > > <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>
> > > > >
> > > > > attributes.releaseDate = 03/02/03
> > > > > attributes.webDate = 3/2/2003
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > 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]
> > >
> >
> >
> >
> >
> >--
> >** 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]


-- 
** 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]

Reply via email to