Search code examples
crystal-reportsrecordsql-viewformula-editor

Crystal Reports: Building a complicated record selection


I have been put in charge of developing an inventory snapshot report that is divided by two types: Orders and Stock. In addition to this, only items with a specific status should show on the report.

I have a parameter that is used to determine the specific date for the report. {?endDate}
I have a field in a view that pulls the date the item was received. {rec_date}
I have a formula field that pulls the group (orders/stock) -- {@grouping}
I have a formula field that pulls the status -- {@state}

Essentially what I need in the record selection is:

( @grouping = "Orders" and rec_date < {?endDate} and @state in (0,2,5) )

OR

( @grouping = "Stock" and rec_date < {?endDate} and @state in (1,2,3,5,7) )

Any way I have been trying to write this has been invalid. Any help would be appreciated.


Solution

  • Your formulas must be in squiggly brackets as well:

    ( {@grouping} = "Orders" and rec_date < {?endDate} and {@state} in [0,2,5] )
    
    OR
    
    ( {@grouping} = "Stock" and rec_date < {?endDate} and {@state} in [1,2,3,5,7] )