Solved

Crystal Reports Recordselection Format

Posted on 2009-05-07
8
554 Views
Last Modified: 2012-05-06
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

0
Comment
Question by:JFitz77777
  • 4
  • 3
8 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 300 total points
ID: 24325865
Try it as

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

mlmcc
 
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24325878
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
 

Author Comment

by:JFitz77777
ID: 24330707
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 24331425
Is budget date a string?

Have you checked the data for the column?

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

mlmcc

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Assisted Solution

by:jgbreeden
jgbreeden earned 200 total points
ID: 24332043
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 24332618
Does it work if you just use

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

mlmcc
0
 

Author Comment

by:JFitz77777
ID: 24332675
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
 

Author Comment

by:JFitz77777
ID: 24332743
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now