?
Solved

Crystal Reports Recordselection Format

Posted on 2009-05-07
8
Medium Priority
?
561 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 1200 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 101

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
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 
LVL 101

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
 
LVL 5

Assisted Solution

by:jgbreeden
jgbreeden earned 800 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 101

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

777 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