You'd need to do this in the sql of the query really.
Depending on your database something like
WHERE Year(DocFiscalYear) >= Year(DateAdd("yyyy",-1,now())) should do it.
I'm assuming your DocFiscalYear column is a date.
Cheers
Will
-----Original Message-----
From: Lorenzo Watts [mailto:[email protected]]
Sent: 30 January 2013 16:35
To: cf-newbie
Subject: <cfoutput> query results
Hi all,
I am new to ColdFusion and just took over an application that was built
several years ago. As I am learning coldfusion one of the things I have
been tasked with doing is limiting the results returned by the query to the
current year minus 1. For instance we are currently in year 2013 so
documents will only be retrieved for 2013 and 2012. As you can see below
the the query "getuserdocuments" returns all documents, is there a way to
limit the result based on the criteria i stated above?
Thanks in advance for your help, Lorenzo
<cfset noRecBgColor="Yellow">
<cfobject component="hbcfc.document" name="Documents">
<cfinvoke component="#Documents#" method="getUserDocuments"
returnvariable="getUserDocuments">
<cfinvokeargument name="cfcUserUserID"
value="#AppLogon_name#">
</cfinvoke>
<!---Header needs to be included in every file ---> <cfinclude
template="header.cfm">
<h3><cfoutput> #AppTitle#<br>
</cfoutput><span style="font-weight: bold"><img src="ekg.gif"
width="198" height="76"></span></h3>
<cfform name="DocList">
<ul>
<li style="font-weight: bold">HeartBeat Documents </li>
<ul>
<cfoutput query="getUserDocuments" >
<cfobject component="hbcfc.document" name="Documents2">
<cfinvoke component="#Documents2#"
method="getDocumentsViewOrEdit" returnvariable="ViewOrEdit">
<cfinvokeargument name="cfcUserUserID"
value="#AppLogon_name#">
<cfinvokeargument name="cfcDocID"
value="#getUserDocuments.DocID#">
</cfinvoke>
<li><span style="font-weight: bold"><a
href="#getUserDocuments.DocType#_<cfif ViewOrEdit is
"Locked">View<cfelse>#ViewOrEdit#</cfif>.cfm?DocID=#getUserDocuments.DocID#"
>
#getUserDocuments.DocType# - #getUserDocuments.DocTitle#</a></span>
<font color="green" size="-2">#getUserDocuments.DocFiscalYear#
(#ViewOrEdit#<cfif ViewOrEdit IS "Edit">/Approve</cfif>)</font></li><br>
</cfoutput>
.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:6046
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm