Solved

Crystal Reports Recordselection Format

Posted on 2009-05-07
8
553 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

706 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