Crystal Reports Filter

Hello,

I have a filter like this:

Local NumberVar Index;
 Local BooleanVar Include := False;

 For Index := 1 to UBound({?Product Type}) do
     Include := Include OR     {tblRevisions.ProductResultBDHC} LIKE '*' & {?Product Type}[Index] & '*';
 Include and

 {tblRevisions.Engineer} = {?Engineer} and
 {tblRevisions.Engineer} <> "" and
 {tblRevisions.CheckerComplete} >= {?Start Date} and
 {tblRevisions.CheckerComplete} <= {?End Date} and
 {tblRevisions.DrawingStage} = {?Stage} and
 (
 ({?RD} = True AND {tblRevisions.JobNumber} > 0)
 OR
({?RD} = False AND ({tblRevisions.JobNumber} <= 90000 OR {tblRevisions.JobNumber} >= 100000))
 )


I need to add this to the filter and I'm not sure how.

if {?RD} = True AND {tblRevisions.JobNumber}  is between 90000 and 10000, then {tblRevisions.ProductResultBDHC} can be anything including null or "".

Thanks,
Joel
Genius123Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
There is nothing to add for that condition.  Is there a restriction on {tblRevisions.ProductResultBDHC}  if {?RD} = FALSE or  {tblRevisions.JobNumber} is not in that range?

mlmcc
0
Genius123Author Commented:
Let me word it differently:

Currently, if {?RD} = True, then it will allow JobNumber between 90000 and 100000 into the report.  Only for those records, I want it to allow the record no matter what the value of ProductResultBDHC is.  Even "" and null.
0
mlmccCommented:
I missed that the ProductResultBDHC field was filtered earlier.  I think this is it.


Local NumberVar Index;
  Local BooleanVar Include := False;

  For Index := 1 to UBound({?Product Type}) do
      Include := Include OR     {tblRevisions.ProductResultBDHC} LIKE '*' & {?Product Type}[Index] & '*';
 
(
   Include and
  {tblRevisions.Engineer} = {?Engineer} and
  {tblRevisions.Engineer} <> "" and
  {tblRevisions.CheckerComplete} >= {?Start Date} and
  {tblRevisions.CheckerComplete} <= {?End Date} and
  {tblRevisions.DrawingStage} = {?Stage} and
({tblRevisions.JobNumber} <= 90000 OR {tblRevisions.JobNumber} >= 100000)
)
OR
(
  {tblRevisions.Engineer} = {?Engineer} and
  {tblRevisions.Engineer} <> "" and
  {tblRevisions.CheckerComplete} >= {?Start Date} and
  {tblRevisions.CheckerComplete} <= {?End Date} and
  {tblRevisions.DrawingStage} = {?Stage} and
  ({?RD} = True  AND ({tblRevisions.JobNumber} >= 90000 AND {tblRevisions.JobNumber} < 100000))
  )

Open in new window


mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
James0628Commented:
Another way to handle it would be to replace

 Include and

   with

(Include OR
({?RD} = True AND
{tblRevisions.JobNumber} > 90000 AND {tblRevisions.JobNumber} < 100000)) and


 I am assuming that "between 90000 and 100000" does not include 90000 or 100000.

 On a related note, if you use mlmcc's suggestion, you probably want to change one of the 90000 tests.  He has <= in one and >= in the other, meaning that 90000 would be included in both cases.  You probably want to remove the = from one of those tests.


 FWIW, you can also use the same tests to skip the For loop that sets Include.  There's no point in going through the values in {?Product Type} if you don't care what's in ProductResultBDHC.  You can just put this If above the For line:

if not ({?RD} = True AND
 {tblRevisions.JobNumber} > 90000 AND {tblRevisions.JobNumber} < 100000) then


 James
0
Genius123Author Commented:
mlmcc's solution worked and the report ran quickly.  James0628, I appreciate your input though.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.