Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

null values in fields

Status
Not open for further replies.

msCrb

Programmer
Aug 29, 2006
9
US
I am displaying a query with fields address1 and address2. I only want address2 to display if there is data in the database. The problem is my <cfif #trim(address2)# NEQ ""><br></cfif> isn't catching everything. When I look in the database their is nothing in the field. Less than 1% of the database has something in the address2 field. When displayed in my results sometimes it displays correctly other times it will not suppress the field.

<cfoutput query="Pharmacy">
<tr <cfif #currentRow# MOD 2>class="ODDTR"<cfelse>"ODDTR"</cfif>>
<td><font size="2"><strong>#name#</strong></font><br>
<font size="2">#address1# <br>
<cfif #trim(address2)# NEQ ""><br></cfif>
#city# &nbsp; #state# &nbsp;#zip#
<br>#phone#</font></td>
<!-- <td>#county# -->
<!-- <br>#city# &nbsp; #state# &nbsp;#zip# -->
</tr>
</cfoutput>

--Results of query---
LAC VIEUX DESERT HEALTH CENTER PHARMACY
23560 E. CHOATE RD.

WATERSMEET MI 49969
(906) 358-4588

THE MEDICINE SHOPPE #1263
200 EAST AYER STREET SUITE 2
IRONWOOD MI 49938
(906) 932-4500

WAKEFIELD PHARMACY
408 SUNDAY LAKE STREET

WAKEFIELD MI 49968
(906) 229-5966


Cathy
 
Code:
<cfif #trim(address2)# NEQ ""><br></cfif>

Should be

<cfif #Len(Trim(address2))#><br></cfif>

Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
I tried all of the code suggestions and it was still giving incorrect results. After looking further I realized that I was missing #address2# after the cfif cfif>#address2#</cfif> After including that I tested the code and each one of the suggestions worked. Thanks for everyone's help.

suggestions
<cfif Len(Trim(address2))>#address2#<br></cfif>
<cfif #Len(Trim(address2))#>#address2#<br></cfif>

original
<cfif #trim(address2)# NEQ "">#address2#<br></cfif>


Cathy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top