Search code examples
crystal-reportscrystal-reports-xi

Crystal Reports - Nested IF Statement Issue


This has worked for me in another Crystal Report, but I am creating another and it is not working. Basically, I need the report to pick 4 states (TX, OK, NM and AZ). However in the state of TX I only want it to pick accounts that have a zip code that starts with certain digits. As I said before it worked in another report, but it is not working in this one. In fact it is basically the same report except instead of choosing who the report is for from parameters, it is by default only using the one parameter. See example below. By all rights this should work, but it is not. I am only getting the TX accounts with those beginning zip codes. Nothing from OK, NM, or AZ. I am sure it is something simple that I am missing, but I am stuck.

{tblAUR_CUST.CustST} = ["TX", "OK", "NM", "AZ"] and
IF {tblAUR_CUST.CustST}="TX" Then {tblAUR_CUST.CustZip} Startswith ["75", "76", "79"]

Solution

  • Please test with this expression:

    {tblAUR_CUST.CustST} = ["OK", "NM", "AZ"] OR ({tblAUR_CUST.CustST}="TX" AND {tblAUR_CUST.CustZip} Startswith ["75", "76", "79"])