Solved

Mutiple Conditions

Posted on 2002-03-12
5
152 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
It worked after I took out the extra & next to the |. I think you overlooked that by accident.
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

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…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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