Hi Fusioneers,

I have an SQL I would like to cache, but have two strategies depending on
the parameters

If the parameters are for the current month, I only want to cache the query
for 1 day
If it is for a past month, I want to start the caching from after the last
day of that month

cfquery has two attributes to do this
    - cachedwithin
    - cachedafter

So I thought I would do this, but it looks like CF does not like the CFIF
inside the cfquery tag
    <cfset rptDate = CreateDate(URL.year, URL.month, DaysInMonth(Now())) />

    <cfquery name="qryStatsByMonth"
                 datasource="#APPLICATION.DataSourceMain#"
                <cfif DateDiff('m', rptDate, Now()) EQ 0>
                      cachedwithin="#CreateTimeSpan(1,0,0,0)#"
                <cfelse>
                       cachedafter="#rptDate#"
                </cfif>
     >

Any ideas how I can do this?

For now, I will put the cfif on the outside and have two cfqueries.
Guess this is not a bad way of doing it, just thought it would be neat if it
could be done with one query.

-- 

AJ Mercer
Web Log: http://webonix.net

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to