0

I have data that I want to filter based on if it matches 1 of 3 criteria.

  1. Sponsor Rating = 0

  2. IT Rating = 0

  3. Evaluation code = NC or - (but there are multiple codes and we do not want to leave them out since they may fit one of the other criteria)

How can I do this without adjusting the Stored Procedure?

So ideally I would like to say

If a record has an eval code of NC or - then I want to see it no matter the ratings If a record has either an IT rating or Spnsr rating equal to 0 then I want to see it regardless of the eval code

I have tried the following in the dataset filters:

Eval_code in NC, - Text

IT rating AND Spnsr Rating = 0 Integer

But this is returning only the record that meet that criteria. There are records with other Eval codes that have IT and Spnsr rating = 0 As well as records that have IT and Sponsr ratings >0 that have a eval code of NC or -.

Thanks

  • Have you tried looking at [Add a Filter to a Dataset](https://msdn.microsoft.com/en-us/library/dd255287.aspx?f=255&MSPPError=-2147217396)? – AWinkle Dec 05 '16 at 19:07
  • Yes, I have tried the following in the dataset filters: Eval_code in NC, - Text IT rating AND Spnsr Rating = 0 Integer But this is returning only the record that meet that criteria. There are records with other Eval codes that have IT and Spnsr rating = 0 As well as records that have IT and Sponsr ratings >0 that have a eval code of NC or - – jfrederick87 Dec 05 '16 at 19:09

1 Answers1

1

Using AND in the where clause requires that all where clauses are met. Using OR requires that only one be met. If you want condition A, B, or C then

Where condition1 = A
OR condition2 = B
OR condition3 = C

If you want Condition A and B or C then

Where condition1 = A
AND (condition2 = B OR condition3 = C)

In your case

Where [EvalCode] IN ('NC','-')
OR [SponsorRating] = 0
OR [ITRating] = 0
Andrew O'Brien
  • 1,793
  • 1
  • 12
  • 24