Crystal Reports - How to include more than one data value in my report

47 views Asked by At

I have a report with this formula

{PRPC.PRGroup} = {?PRGroup} and
{PRPC.PRCo} = {?PRCo} and
{PRDT.EDLType} in ["D", "L"] and
{@AcctMth} in {?BegAcctMth} to {?EndAcctMth} and
{PRDT.EDLCode} = 1

My issue is with that final part

{PRDT.EDLCode} = 1

I now have a need for the report to also show "2", "3", "4" and "7" if they happen to have data against them. I attempted a simple 'OR' operator and it does populate, but the amount should be 461 and instead its 150k odd. The month parameter above relate to payroll months. At the moment if I specify say june to june 15, the field 1 - populates with only June 15 payroll data but the field = 4 - brings in several years of data back.

Any ideas on how to include further instances of {PRDT.EDLCode} = x ?

1

There are 1 answers

0
heringer On

Did you used parenthesis correctly with the OR operations? I mean, it should be:

{PRPC.PRGroup} = {?PRGroup} and
{PRPC.PRCo} = {?PRCo} and
{PRDT.EDLType} in ["D", "L"] and
{@AcctMth} in {?BegAcctMth} to {?EndAcctMth} and
( {PRDT.EDLCode} = 1 OR {PRDT.EDLCode} = 2 )

I am not sure about Crystal Reports, but in SQL the logical operator AND has precedence over OR, like you can check here. So, you need the parenthesis.