Search code examples
crystal-reports

Crystal Formula that evaluates a boolean field OR field containing not null value


Is there a way to evaluate two fields to count the total number of records that meet the following criteria

Field {NoValidAddress} = False OR Field {Email} = not null 

I'm very new to Crystal so I've created a formula field so I've used the following, but this returns the total number of records in the table.

{NoValidAddresses} = false OR not (IsNull({Email})

Thank you for any help that can be given


Solution

  • You can easily count the number of records with values in the email field by using a formula similar to the following:

    if not(isnull({Email})) or ({NoValidAddresses} = False) then 1 else 0
    

    Once the formula is created, follow these steps:

    • Drag the formula onto the report as a field
    • Right click the field --> Insert --> Summary...
    • Set "Calculate this summary" to "Summary"
    • Check the "Add to all group levels" box

    Adding the total to all group levels is probably not necessary, but it will show you the total at each group level so that you can determine which one you want to use and suppress/delete the rest.