> Yep, to localize a variable, just use the var scope:

Okay, I'm confused even more now... I thought that UDF's in CF5 were done
inside of CFScript and in MX are done using CFFunction - that's how I've
been doing it.

Here's the UDF that was causing the problem -

<cffunction name="SetDefaultValues" returntype="query" access="private"
output="false">
<cfargument name="UseDate" required="yes">
<cfset DateStart = CreateDate(Year(UseDate), Month(UseDate), 1)>
<cfset NumDays = DaysInMonth(DateStart)>
<cfset qDefaultPlan = QueryNew("id,dEntry,Hours,Downtime,Rate")>
<cfloop from="1" to="#NumDays#" index="t">
<cfset DefaultDate = CreateDate(Year(UseDate),
Month(UseDate), t)>
<cfset temp = QueryAddRow(qDefaultPlan)>
<cfset temp = QuerySetCell(qDefaultPlan, "id", t)>
<cfset temp = QuerySetCell(qDefaultPlan, "dEntry",
CreateODBCDate(DefaultDate))>
<cfset temp = QuerySetCell(qDefaultPlan, "Hours", 20)>
<cfset temp = QuerySetCell(qDefaultPlan, "Downtime", 4)>
<cfset temp = QuerySetCell(qDefaultPlan, "Rate", 550)>
</cfloop>
<cfreturn qDefaultPlan>
</cffunction>

Without explaining the business logic, this simply creates a "default
values" query... the offending variable has been renamed in this case to
"DefaultDate".  I know that this could very easily be rewritten to work in a
CFScript... but I was also told that MX removed a lot of the performance
differences.

How do I "var" in this instance?

Hatton

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.699 / Virus Database: 456 - Release Date: 6/4/2004
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to