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
Solved

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

Posted on 2014-10-14
3
162 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
  • 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

789 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