Solved

Mutiple Conditions

Posted on 2002-03-12
5
158 Views
Last Modified: 2013-12-18
I have these conditions in a view selection separated with an OR (|) however the view is only using one of the conditions. Is there another way of doing this?  Here is my code:

SELECT (@Contains(qcspecs; "Yes")) & (@Contains(koshstat; "Yes")) & (@Contains(microspecs; "Yes")) & (@Contains(takenoff; "No")) & (@Contains(scaleyesno; "No")) | (@Contains(qcspecs; "Yes")) & (@Contains(koshstat; "Yes")) & (@Contains(microspecs; "Yes")) & (@Contains(takenoff; "No")) & (@Contains(scaleyesno; "Yes")) & (@Contains(scalecomplete; "Yes"))

Willing to up the points for a good answer.
0
Comment
Question by:schmad01
[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
5 Comments
 

Accepted Solution

by:
David_Gordon earned 65 total points
ID: 6858216
Try this:

SELECT @Contains(qcspecs; "Yes") & @Contains(koshstat; "Yes") & @Contains(microspecs; "Yes") & 
@Contains(takenoff; "No") & (@Contains(scaleyesno; "No") | & (@Contains(scaleyesno; "Yes")
& @Contains(scalecomplete; "Yes")))



Use parentheses to group conditions as per the intended logic in this part of the code: (@Contains(scaleyesno; "No") | & (@Contains(scaleyesno; "Yes")
& @Contains(scalecomplete; "Yes"))); This translates to "if scaleyesno is No OR (if scaleyesno is Yes AND scalecomplete is yes)"

Try to avoid using extra parentheses if possible. Although they are technically correct, they are an obstacle to comprehension.

0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6858218
SELECT @Contains(qcspecs; "Yes") & 
@Contains(koshstat; "Yes") & 
@Contains(microspecs; "Yes") & 
@Contains(takenoff; "No") & 
(@Contains(scaleyesno; "No") | @Contains(qcspecs; "Yes")) & 
@Contains(koshstat; "Yes") & @Contains(microspecs; "Yes")&
@Contains(takenoff; "No") & @Contains(scaleyesno; "Yes")&
@Contains(scalecomplete; "Yes")

Probably you should group the or clause.

If you could put the logic in plain words then I can see where it goes wrong.

PS: I have removed the extra brackets which is not necessary.

~Hemanth
0
 
LVL 10

Expert Comment

by:zvonko
ID: 6858238
My proposal is:
SELECT (@Contains(qcspecs; "Yes")&@Contains(koshstat; "Yes")&@Contains(microspecs; "Yes")&@Contains(takenoff; "No"))&(@Contains(scaleyesno;"No")|(@Contains(scaleyesno; "Yes")
&@Contains(scalecomplete;"Yes")))

<|;-)

0
 
LVL 10

Expert Comment

by:zvonko
ID: 6858266
Explanation:
Always required:
qcspecs="Yes",koshstat="Yes",microspecs="Yes",takenoff="No"

but scalecomplete is not set: scaleyesno="No"
Or: scaleyesno="Yes" AND scalecomplete="Yes"

Dacor?

0
 

Author Comment

by:schmad01
ID: 6858331
It worked after I took out the extra & next to the |. I think you overlooked that by accident.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

624 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