ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old October 15th, 2004, 12:58 PM
earwiged earwiged is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 1 earwiged User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old October 15th, 2004, 04:16 PM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 22
Send a message via AIM to bocmaxima
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.

Reply With Quote
  #3  
Old October 15th, 2004, 06:27 PM
dRD dRD is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 7 dRD User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 50 m 11 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Empty String to Display a Given Text


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway