Solved

Mutiple Conditions

Posted on 2002-03-12
5
153 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

19 Experts available now in Live!

Get 1:1 Help Now