Solved

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

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intranet Site for Medical Practice 7 51
Validating Date 4 29
Adding 1 the value of input "text" every 3 seconds 5 33
TypeError jquery issues with site - CSS conflicts 3 28
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This video teaches users how to migrate an existing Wordpress website to a new domain.

733 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