PDA

Click to See Complete Forum and Search --> : Crystal Reports 10 Formula Issue?


blakemckenna
May 27th, 2009, 11:44 AM
I have a CR 10 report in which it takes a Date Parameter. This parameter is defined Where "Allow multiple values" is checked and "Discrete and Range Values" is selected.

I'm not sure if my Record Selection criteria is correct for this Parameter. Here is what the Record Selection looks like.


{AR_OpenInvoice.InvoiceType} = "FC" and
{AR_OpenInvoice.CustomerNo} = {?CustNo} and
{AR_OpenInvoice.InvoiceDate} = {?InvoiceDate}


The highlighted line doesn't seem to be working. Basically, the query is not returning a range of records between the 2 date parameters and I don't think I have that highlighted line set up right but not sure how to construct it. The image below is how I have setup my Parameter. Any ideas?

Thanks,

brucevde
May 27th, 2009, 12:08 PM
All you need to do is use In instead of =

{AR_OpenInvoice.InvoiceDate} In {?InvoiceDate}

blakemckenna
May 27th, 2009, 12:18 PM
even though there are 2 dates?

brucevde
May 27th, 2009, 12:34 PM
1, 2 or 1000 dates it doesn't matter. The SQL Statement generated by Crystal ensures the Date field is checked against each Range or Discrete value in the Parameter.

Because the parameter allows multiple Ranges and/or Discrete values a user could enter all of the following

01-Mar-1998 31-Mar-1998 'Range value
24-Jul-1997 'Discrete value.
17-Jul-1997 'Discrete value.
01-Jan-1998 31-Jan-1998 'Range valuie

The SQL statement generated by Crystal would be (depending on database and connection type)

InvoiceDate >= {d '1998-03-01'} AND InvoiceDate <= {ts '1998-03-31 23:59:59.000'} OR
InvoiceDate>= {d '1997-07-24'} AND InvoiceDate <= {ts '1997-07-24 23:59:59.000'} OR
InvoiceDate >= {d '1997-07-17'} AND InvoiceDate <= {ts '1997-07-17 23:59:59.000'} OR
InvoiceDate >= {d '1998-01-01'} AND InvoiceDate <= {ts '1998-01-31 23:59:59.000'}

blakemckenna
May 27th, 2009, 02:44 PM
Thanks Bruce....I tried doing that and it didn't work, however, I think we may some database issues. But what you are saying makes sense and I will stick with that.

Thanks again for your help!