Solved

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

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

Expert Comment

by:Big Monty
ID: 40379742
Try this

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now