Solved

Simple IF NOT Statement

Posted on 2004-04-06
7
201 Views
Last Modified: 2006-11-17
I have this IF NOT Statement:-

<% if NOT varRequest ="All New loads" OR  varRequest ="All New NEW Loads" then%>

<DIV title="Manifest has arrived">M = Manifest has Arrived</div>
<DIV title="Booked out">B = Load Booked Out</DIV>
<DIV title="Arrival of Driver">A = Arrival of Driver</DIV>
<%end if%>

I have also added an OR in the statement, for some reason it does not pick up the second part of the OR statement.

Am I using the incorrect syntax?  
I have tried:-

<% if NOT varRequest ="All New loads" OR NOT  varRequest ="All New NEW Loads" then%>

and this does not work either.

please help
0
Comment
Question by:Pigdogmonster
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 20 total points
Comment Utility
Hi Pigdogmonster,

I assume you want:

<% if NOT (varRequest ="All New loads" OR  varRequest ="All New NEW Loads") then%>

Which will display your stuff if neither condition is true.

Tim Cottee
Brainbench MVP for Visual Basic
http://www.brainbench.com
0
 
LVL 1

Expert Comment

by:Rajmahesh
Comment Utility
hi
if both the conditions are checking for not having that value u can use like

<% if varRequest <> "All New loads" OR varRequest <> "All New NEW Loads" then%>

this ll work
0
 

Author Comment

by:Pigdogmonster
Comment Utility
thats it! thanks.

Do normal IF statements work without the brackets?  i.e

if varRequest ="All New loads" OR  varRequest ="All New NEW Loads" then

These seem to work wothout the brackets?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 43

Expert Comment

by:TimCottee
Comment Utility
Rajmahesh,

No you cannot, that will actually make it happen every time, need an AND if you are negatively testing two exclusive conditions:

<% if varRequest <> "All New loads" AND varRequest <> "All New NEW Loads" then%>

Or

<% if NOT varRequest ="All New loads" AND NOT  varRequest ="All New NEW Loads" then%>

Tim.
0
 
LVL 1

Expert Comment

by:Rajmahesh
Comment Utility
im sorry timcottee
i dint see that
that should be as u said
that's a mistake
0
 
LVL 7

Expert Comment

by:brgivens
Comment Utility
Rajmahesh's solution will always return true:

if varRequest <> "All New loads" OR varRequest <> "All New NEW Loads"

varRequest = "All New loads"  ->  if False Or True  ->  True
varRequest = "All New NEW Loads"  ->  if True Or False  ->  True

What you probably want is

if varRequest <> "All New loads" AND varRequest <> "All New NEW Loads"

Pigdogmonster, the brackets <> mean "is not equal to".  the condition can also be stated this way:

if Not varRequest = "All New loads" AND Not varRequest = "All New NEW Loads"

or even:

if Not (varRequest = "All New loads" OR varRequest = "All New NEW Loads")

the reason for the OR in the last version is that using the NOT outside the brackets changes the AND to an OR
0
 
LVL 7

Expert Comment

by:brgivens
Comment Utility
oops... I don't know why I didn't see the two comments above mine... never mind me :|
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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

763 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

11 Experts available now in Live!

Get 1:1 Help Now