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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why does this not work

Status
Not open for further replies.

chaddu1256

IS-IT--Management
Jan 13, 2003
28
0
0
US
<%
//to test for null values
String va2 = &quot;&quot;;
if (utilWrap1.getExtension8() == 0.000000){
va2 = &quot;&nbsp;&quot;;
}
else{
va2 = utilWrap1.getExtension8();
}
%>

For some reason this is breaking the page. Basically the utilWrap1.getExtension8 is pulling some stuff out of an oracle database, in this case it is a Water Meter Reading. When there is actually a reading in the table it displays on our web page. ex. 3459.000000 When there is no meter reading it displays as 0.000000. What we want is for it to display a blank space instead of 0.000000. I inserted this little piece of code and it breaks our page every time. Anyone help?
 
Without knowing what is returned... let's cast it to a string and use the string .equals to do the test:

Code:
if (utilWrap1.getExtension8()toString().equals(&quot;0.000000&quot;)){

Jeff
 
And now with the correct syntax (*hides his head*):

Code:
if (utilWrap1.getExtension8().toString().equals(&quot;0.000000&quot;)){

Jeff
 
thanks alot babyjeffy, worked like a champ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top