creelove,
Which query are you trying to cache? There are several queries in the PDF code sample and I know you mentioned you changed the code a bit but I'm guessing that the queries are similarly structured in your conditionals (suggestion on that below).
If it's the cfquery named 'qry_record' that you are looking to cache, that's going to be an issue. To cache a query (unless this has changed in CF 8, which I haven't checked), the query must be *exactly* the same.
This query:
<cfquery name="qry_record" datasource="#dsn#" cachedwithin="#blah#">
select * from my table where itemA = '#itemA#'
</cfquery>
Is not the same (in terms of caching) as this query:
<cfquery name="qry_record" datasource="#dsn#" cachedwithin="#blah#">
select * from my table where itemB = '#itemB#'
</cfquery>
Without the 'matching' queries, caching will not work as you expect.
One other thing I noticed is that your hidden field (<input type="hidden" name="filter" and value="yes" />) isn't using a dynamic value, it's always yes. Don't know if that might lead to an issue for you but thought I'd call it out (since you pass in a key/value in the URL for 'filter').
Given the code, which variable were you trying to store in the session scope and how were you going about that (it wasn't in the code sample, unless I missed it!)?
The qry_record query:
This is just a suggestion and what you have is not wrong, so please disregard if you wish
.
You're repeating the qry_record several times in your code and you could just do it in one shot (thus making the code a bit easier for you to read and debug). The qry_record query, in the respective conditional block, is the same in all instances, except for the where clause:
<cfquery name="qry_record">
select *
from data.WF_Masterview2
^^ where x = y ^^
order by = #orderby#
</cfquery>
You could setup the WHERE part of your query in the conditional block and then type the query once at the end (much like what you do when you setup the orderby variable):
<cfif itemA is not "">
<cfscript>
col = 'itemA'
val = #itemA#
</cfscript>
<cfelseif itemB is not "">
<cfscript>
col = 'itemB'
val = #itemB#
</cfscript>
<cfelseif itemC is not "">
<cfscript>
col = 'itemC'
val = #itemC#
</cfscript>
<cfelse>
<cfscript>
col = 'itemA'
val = #itemA#
</cfscript>
</cfif>
After this conditional block runs, you can run the query:
<cfquery name="qry_record>
select *
from data.WF_Masterview2
where #col# = '#val#'
order by = #orderby#
</cfquery>