How are you storing your functions?  If you are loading them into the
application scope on application start, then you will need to restart your
application before they are restored in that scope.  

If this is not the case, then please share with us how you are calling the
function from your code.

-- 
William E. Seiter
 
Have you ever read a book that changed your life?
Go to: www.winninginthemargins.com
Enter passkey: goldengrove
 
Web Developer 
http://William.Seiter.com

-----Original Message-----
From: Walter Conti [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 28, 2008 5:01 PM
To: CF-Newbie
Subject: Adding a cffunction to a cfc

I needed a random date generator and I have found three different cffunction
which teoretically should do exactly what I want. Unfortunately when I
insert any of them in my utils.cfc I get the error that the method was not
found in that component. The other methods included there work fine.

Please advise. Thank you very much.

One of the cffunction is the following:

<cffunction name="RandDateRange" access="public" returntype="date"
output="false" hint="Returns a random date between the two passed in dates.
If either of the two dates has a time value, the resultant time will also be
randomized.">
<cfargument name="DateFrom" type="date" required="true" hint="The min date
of the date range."/>
<cfargument name="DateTo" type="date" required="true" hint="The max date of
the date range."/>
<cfargument name="IncludeRandomTime" type="boolean" required="false"
default="false" hint="Will include the time in the date randomization even
if neither passed-in dates have a time." />
<cfset var LOCAL = StructNew() />

<cfif ((ARGUMENTS.DateFrom NEQ Fix( ARGUMENTS.DateFrom )) OR
(ARGUMENTS.DateTo NEQ Fix( ARGUMENTS.DateTo )) OR
ARGUMENTS.IncludeRandomTime)>
   <cfset LOCAL.DiffSeconds =
DateDiff("s",ARGUMENTS.DateFrom,ARGUMENTS.DateTo) />
   <cfset LOCAL.Date = (ARGUMENTS.DateFrom + CreateTimeSpan(0,0,0,RandRange(
0,LOCAL.DiffSeconds))) />
   <cfreturn DateFormat( LOCAL.Date ) & " " & TimeFormat( LOCAL.Date )/>
<cfelse>
   <cfreturn DateFormat( RandRange( ARGUMENTS.DateFrom, ARGUMENTS.DateTo))
/>
</cfif>
</cffunction> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3284
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to