Solved

Crystal Reports Recordselection Format

Posted on 2009-05-07
8
555 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

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 …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 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