passing wildcards to crystal report

  • Thread starter Thread starter raf_z
  • Start date Start date
R

raf_z

Hi,

I'm running a website with Asp.NET, and on one of the pages i have a
crystal report with 3 user-populated parameters. However, not all
params might be selected. Example:

Parameters:
1. EmployeeID
2. First Name
3. Last Name

Sometimes the report will be generated with all 3 params populated,
sometimes with only 2, or 1. Is there any way to pass a wildcard
character for any params that aren't explicitly set by the user? I
tried passing '%' for strings, but that crashed, saying "Input string
was incorrectly formatted" or something of that sort.

I appreciate any suggestions or workarounds.


Thanks.

Rafael Zavulunov.
 
R,

No wildcards as such. You have several options, though,

a) If the parameter values are to be used for selection of rows (WHERE
clause of the query), consider using the RecordSelectionFormula property
instead of parameters. You in C# read the values of the params, and generate
the selection formula to pass to the report.
b) Send the parameters to Crystal as they are, and use one of the Crystal
Reports formula languages (VB-like or Pascal-like) to specify the selection
formula for the records. This is more powerful in general, but might be less
eficient as it may imply that Crystal will read all the records of the
original tables and do the filtering on the client machine (in this case the
web server).

Regards - Octavio
 
Thank you for the reply it worked, however i have follow question: what
if in my lastname field i want to be able to do a wildcard search based
on 1 or a few letters, for example passing in "Ab" would return
Abbots
Abrams
Abe

In sql i was able to do "Ab%" i dont suppose i could do this in crystal
by modifying the recordselectionformula as before?
 
Raf,

The Crystal language offers a lot of string manipulation functions,
including one similar to LIKE. I also believe, the Crystal engine has some
"intelligence" to transform this call into a SQL LIKE clause, in order to
gain efficiency.

Regards - Octavio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top