All,
I'm trying to fix someone's code and I'm getting this error within a datediff.
When I do a cfdump on the query variable UserCoupon.LastDownloadDate
I get [empty string]. However when I do the query myself I get a single record
returned. Is there something wrong with this syntax. This code was originally
written against MSAccess, it's been since moved to SQL Server.
Any help would be much appreciated.
Error starts with ...
Null Pointers are another name for undefined values.
The error occurred in D:\Inetpub\wwwroot\site\website\coupons\viewcoupons.cfm:
line 184
182 : <CFSET CouponFlag = 0>
183 : <CFELSE>
184 : <CFIF DateDiff('D', UserCoupon.LastDownloadDate,
(DateFormat(Now(),"mm/dd/yyyy"))) GTE Coupons.RefreshDays>
185 : <CFSET CouponFlag = 0>
186 : </CFIF>
Here's the actual cf code. (Not my code)
<CFQUERY Name="Coupons" datasource="ds"> select * from Coupons where
StartDate <= #CreateODBCDateTime(now())# and EndDate >=
#CreateODBCDateTime(now())# and CompanyID = 1 order by CouponOrder ASC
</CFQUERY>
<CFOUTPUT Query="Coupons">
<CFQUERY datasource="ds" Name="UserCoupon">
select *
from UserCoupons
where UserID = #cookie.userID# and
CouponID = #Coupons.ID#
</CFQUERY>
MY TROUBLESHOOTING
LASTD:<CFDUMP var="#UserCoupon.LastDownloadDate#" label="userlastdown"
expand="yes"><br>
COOKIE.USERID:<CFDUMP var="#cookie.userID#" label="userlastdown"
expand="yes"><br>
COUPON ID:<CFDUMP var="#Coupons.ID#" label="userlastdown"
expand="yes"><br>
RESULTS:
UserCoupon.LastDownloadDate CFDUMP = [empty string]
COOKIE.USERID: 24884
COUPON ID: 269
MY TROUBLESHOOTING
<CFIF UserCoupon.RecordCount EQ 0>
<CFSET CouponFlag = 0>
<CFELSE>
ERROR HAPPENS HERE
<CFIF DateDiff('D', UserCoupon.LastDownloadDate,
(DateFormat(Now(),"mm/dd/yyyy"))) GTE Coupons.RefreshDays>
ERROR HAPPENS HERE
<CFSET CouponFlag = 0>
</CFIF>
</CFIF>
</CFOUTPUT>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:259670
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4