How Can I Call A Function In Another Cfc File From Within A Query Of A Function In One Cfc File?
I have one cfc file (info.cfc) with multiple functions as shown below. </cfquery><cfsetdf = createobject("component","DateFunctions")><cfloopquery="records"><cfsetrecords.Due_DATE = df.addBusinessDays(Days_Due,Start_Date)></cfloop><cfreturnrecords></cffunction>
Solution 2:
Rather than creating the df object, it should be tied to the this scope. That way the object is created only once. This should make the viewDate function run faster as there is no overhead in creating df.
Also, new is just a cleaner syntax
<cfcomponent><cfsetthis.df = newDateFunctions()><cffunctionname="viewDate"access="remote"returntype="any"output="false"returnformat="plain"><cfqueryname="Local.records">
SELECT
dbo.tickets.Incident,
dbo.tickets.Start_Date,
dbo.tickets.Days_Due,
CAST(NULL AS datetime)
FROM
dbo.tickets
</cfquery><cfloopquery="Local.records"><cfsetLocal.records.Due_DATE = this.df.addBusinessDays(Local.records.Days_Due, Local.records.Start_Date)></cfloop><cfreturnLocal.records></cffunction><cfcomponent>
Post a Comment for "How Can I Call A Function In Another Cfc File From Within A Query Of A Function In One Cfc File?"