Solved

ASP code to display region if result is <> '0'

Posted on 2014-10-14
3
171 Views
Last Modified: 2014-10-14
I am displaying a total (money) if the recordset returns a record, otherwise it displays an error, the problem is that the result is being formatted as currency and if the result is '0' it displays an error  :$

this is my code:

  <% if (!TotalAvailable.EOF || !TotalAvailable.BOF) { %>
              <%= DoCurrency((TotalAvailable.Fields.Item("TotalAvailable").Value), 2, -2, -2, -2) %>
              <% } // end !TotalAvailable.EOF || !TotalAvailable.BOF %>


How can I change my IF statement so that it only displays also if the result is <> 0 ?

Aleks
0
Comment
Question by:amucinobluedot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 40379742
Try this

<% if (!TotalAvailable.EOF || !TotalAvailable.BOF && TotalAvailable.Fields.Item("TotalAvailable").Value != 0 ) { %>
0
 
LVL 33

Accepted Solution

by:
Big Monty earned 500 total points
ID: 40379819
actually, this is a better way to do it:

 <% if (!TotalAvailable.EOF || !TotalAvailable.BOF) { 
              if( TotalAvailable.Fields.Item("TotalAvailable").Value != 0 )           %>
                      <%= DoCurrency((TotalAvailable.Fields.Item("TotalAvailable").Value), 2, -2, -2, -2) %>
 <% } // end !TotalAvailable.EOF || !TotalAvailable.BOF %>

Open in new window


this way, it'll only check for the zero value IF there are records returned
0
 

Author Closing Comment

by:amucinobluedot
ID: 40380013
Thx !
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question