I'm sure I'm missing something simple, but if someone could show me where I'd appreciate it.
I'm running what I thought was a fairly simple CFIF-based conditional that doesn't seem to work as I hoped. The Form.date parameter is being passed, and my database has two records dated 2005-07-15. This conditional was designed to stop a record from being created if a date already exists, but it is not. Am I missing something on my logic?
... when I bang this against the database using a query for 2005-07-15, I get this result:
This seems fine right? But when I change the logic from "<CFIF qWeekEnding.RecordCount NEQ 0>" to "<CFIF qWeekEnding.RecordCount EQ 0>" I get this result.
The recordcount function is working properly in the display (there are two records), but not in the CFIF conditional. Am I doing something wrong here?
I'm running what I thought was a fairly simple CFIF-based conditional that doesn't seem to work as I hoped. The Form.date parameter is being passed, and my database has two records dated 2005-07-15. This conditional was designed to stop a record from being created if a date already exists, but it is not. Am I missing something on my logic?
Code:
<cfparam name="t_date" default="Form.t_date">
<cfparam name="report_id" default="report_id">
<CFQUERY NAME="qWeekEnding" DATASOURCE="yyy">
SELECT t_date, report_id
FROM report
WHERE t_date = '#Form.t_date#'
</CFQUERY>
<CFIF qWeekEnding.RecordCount NEQ 0>
Yes, there are records for 2005-07-15.<br>
Total Records: <CFOUTPUT>#qWeekEnding.RecordCount#</CFOUTPUT>
<CFELSE>
No, there are no records for 2005-07-15.<br>
Total Records: <CFOUTPUT>#qWeekEnding.RecordCount#</CFOUTPUT>
</CFIF>
... when I bang this against the database using a query for 2005-07-15, I get this result:
Code:
Yes, there are records for 2005-07-15.
Total Records: 2
This seems fine right? But when I change the logic from "<CFIF qWeekEnding.RecordCount NEQ 0>" to "<CFIF qWeekEnding.RecordCount EQ 0>" I get this result.
Code:
"No, there are no records for 2005-07-15.
Total Records: 2
The recordcount function is working properly in the display (there are two records), but not in the CFIF conditional. Am I doing something wrong here?