>In case anyone is interested, my brute force solution is below. She
>aint pretty, but she works.
Mike,
That is not bad. But you could improve it even more if you looped by year,
instead of day. That would eliminate most of the iterations. Not highly tested,
but something like this.
<cffunction name="getExchangeFilterDateRanges" returntype="query"
access="public" output="no">
<cfargument name="startDate" type="date" required="yes">
<cfargument name="endDate" type="date" required="yes">
<cfset var y = "">
<cfset var row = "">
<cfset var q = queryNew("startDate,endDate", "date,date")>
<!--- ** note, should handle case where startDate > endDate --->
<cfloop from="#year(arguments.startDate)#"
to="#year(arguments.endDate)#" index="y">
<!--- populate mininum/maximum dates for the current year --->
<cfset row = queryAddRow(q, 1)>
<cfset q["StartDate"][row] = createDate(y, 1, 1)>
<cfset q["EndDate"][row] = createDate(y, 12, 31)>
</cfloop>
<cfif q.recordCount gt 0>
<!--- replace the initial start date and final end date --->
<cfset q["StartDate"][ 1 ] = arguments.startDate>
<cfset q["EndDate"][ q.recordCount ] = arguments.endDate>
</cfif>
<cfreturn q >
</cffunction>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315640
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4