Crystal Reports Recordselection Format

Hi -
I have a Crystal Report Viewer in VS2005 that I am trying to set the recordsource form two multiselect listboxes. The following resulting line returns only the final item in the array, in this case Customer2. I believe I am using the wrong punctutation or delimiter:


CrystalReportViewer1.SelectionFormula = {Budget.Customer} in ('Customer1';'Customer2') and {Budget.Date} = '30-Apr-2009'"
CrystalReportVIewer1.RefreshReport

Open in new window

JFitz77777Asked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
Try it as

CrystalReportViewer1.SelectionFormula = "{Budget.Customer} in ['Customer1','Customer2'] and {Budget.Date} = '30-Apr-2009'"
CrystalReportVIewer1.RefreshReport

mlmcc
 
0
 
mlmccCommented:
If that doesn't work you may have to use

CrystalReportViewer1.SelectionFormula = "{Budget.Customer} in ['Customer1','Customer2'] and {Budget.Date} = Date(2009,4,30)"
CrystalReportVIewer1.RefreshReport

mlmcc
0
 
JFitz77777Author Commented:
The bracket seems to have gotten me closer as it works if I remove the date portion and returns both values; however, with the date portion included ( I tried both your methods above, and also tried the # delimiter as shown) I get:

A string is required here. Error in File C:\DOCUME~1\JFIT~1\LOCALS~1\Temp\rptVariance {07A44CC4-1227-4473-9135-DC86D2FF1BAD}.rpt: Error in formula . '{Budget.Customer} in ['Company1','Company2'] and {Budget.Date} = #31-Mar-2009#' A string is required here.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
mlmccCommented:
Is budget date a string?

Have you checked the data for the column?

Perhaps it is in '2009-04-30' format

mlmcc

0
 
jgbreedenConnect With a Mentor Commented:
SelectionFormula needs to be a string--in your first example, there are no quotes.  Did you put quotes around the whole formula, as mlmcc has in the examples?
0
 
mlmccCommented:
Does it work if you just use

CrystalReportViewer1.SelectionFormula = "{Budget.Customer} in ['Customer1','Customer2'] "

mlmcc
0
 
JFitz77777Author Commented:
It does work if I drop the second half (the date qualifier) and it corerctly selects the two values. I am passing it from ASP.NET; I will try to add a CHR(34) to each side of the full string to see if that makes a difference.
0
 
JFitz77777Author Commented:
Guys - thanks -- the final tweak was that I had been using a hiddenfield which uses value instead of text, so changing them to hidden labels solved the issue and it appears to work fine now -- thanks again!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.