|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Empty String to Display a Given Text
OK, I'm new to CF and I am having an issue with an empty string. I want to display a "text" if string is empty. This is for a library application I am working on.
First I query, <cfquery datasource="#CW_datasource#" name="Loans">2 SELECT StatusOCLC, ReqDate, DueDate, Author, Title, Article, Patron1, ILL, PatronID, Vol, Date, No AS issuenumber, PageNums, PDFCopiedToServer FROM <cfif UsingClioDET IS "yes">cliodataRequestsExport.txt<cfelse>BorrowingRequests</cfif> WHERE (<cfif UseDBAuthentication IS "yes">PatronID = #Ucase(session.patronID)#<cfelse>Patron1 = '#Ucase(session.patronID)#'</cfif>) AND ((StatusOCLC IN ('SHIPPED','Pending','IN PROCESS','')) OR ((StatusOCLC = 'Received') AND (StatisticsDate > #BooksDaysOld#)) OR ((StatusOCLC = 'Received') AND (StatisticsDate > #ArticlesDaysOld#))) ORDER BY DueDate </cfquery> Then I want to serve up the following replacing certain words: <!--- do the status adjustments ---> <cfif Trim(StatusOCLC) is "Received"> <cfset Status = "Received"> <cfelseif Trim(StatusOCLC) is "SHIPPED"> <cfset Status = "Shipped"> <cfelseif Trim(StatusOCLC) is "In Process" OR Trim(StatusOCLC) is "Pending" OR Trim(StatusOCLC) is ""> <cfset Status = "Pending"> <cfelse> <cfset Status = "Unknown"> </cfif> The issue is, that all empty strings are not being display. Not that they are coming up as "Pending", rather that they are not showing at all. So, the question is, how do I make an empty string display the text "Pending"? Thanks for any info... Sorry by the weak nomenclature. ![]() |
|
#2
|
||||
|
||||
|
Try "Len(StatusOCLC) EQ 0" instead.
If that doesn't work, try outputting all of your results (without using Trim) so that you can see exactly how they're getting displayed. |
|
#3
|
|||
|
|||
|
First of all, I'd add one pair or brackets:
patronID)#'</cfif>) AND ((StatusOCLC to patronID)#'</cfif>) AND (((StatusOCLC and close it at the end of StatisticsDate > #ArticlesDaysOld#))) to StatisticsDate > #ArticlesDaysOld#)))) ..as what I can read from your SQL, it should make it clearer what your SQL is trying to do? And secondly, would do exactly what bocmaxima suggested -- simply cfoutput through your query results and output it into semicolon separated text format and look at the source to see whether there is anything fishy in the columns. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Empty String to Display a Given Text |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|