Reputation: 3166
I am getting data from a query and two of the outputs are dates:
<cfset qryResult = queryNew("status,start_date,end_date","varchar,date,date")>
<cfif qryFeedbackSurvey.recordcount>
<cfset querySetCell(qryResult, "status",qryFeedbackSurvey.response_count)>
<cfset querySetCell(qryResult, "start_date",qryFeedbackSurvey.start_date)>
<cfset querySetCell(qryResult, "end_date",qryFeedbackSurvey.end_date)>
<cfelse>
<cfset querySetCell(qryResult, "status","Get Feedback")>
<cfset querySetCell(qryResult, "start_date","">
<cfset querySetCell(qryResult, "end_date","")>
</cfif>
When I dump this, if there is no date in the row, then it outputs [empty string]
.
If there is no date available, how can I output something in place of the empty string. Is there a method to push a text string to that field?
Upvotes: 0
Views: 97
Reputation: 1388
When you are calling querySetCell() for your dates, check to see what's in the date field. Set the qryResult field accordingly.
<cfif qryFeedBackSurvey.start_date eq "" or not isDate(qryFeedBackSurvey.start_date)>
<cfset querySetCell(qryResult,"start_date","No start date specified")>
<cfelse>
<cfset querySetCell(qryResult,"start_date",qryFeedBackSurvey.start_date)>
</cfif>
Upvotes: 1