How do I specify selection criteria in Crystal Reports ?

This is a follow up to a previous question

I am using VS2005 and Crystal Reports.  I have created formulas to calculate various fields on the report.  Now I want to allow the user to select records based on field values.

For example I want to provide a checkbox on my VB form that, when checked will only return records on the report where the value of a  calculated field is greater than 500.

This would be difficult (but not impossible) to do via SQL, so I would rather do it in the report.

Thanks for any help.
Who is Participating?
mlmccConnect With a Mentor Commented:
When you say calculated field, is this something that involves a single record?

Crystal formulas using multiple are executed after the records are selected thus cannot be used to effectively filter the data.  If you are referring to the referenced formula, it can't be used in Crystal to filter.  You may be able to use it to suppress records.

SteveB2175Author Commented:

The calculated fields are based on the solution you provided to me earlier today (click the link above).

They do involve 2 records.

Suppressing the records would accomplish what I am after.
If you are only getting 2 records per group
Try this

IN the report header modify the DECL_VARS  formula
Add this line
Global BooleanVar boolSuppress := False;

In the group header
Right click the left margin of the group header
Click the FORMULA button to the right of SUPPRESS
Global BooleanVar boolSuppress;
boolSuppress := ({PriceField} + Next({PriceField})) < 500;

Similarly in the detail and group footer section conditionally suppress with
Global BooleanVar boolSuppress;

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

SteveB2175Author Commented:

Let me ask you about programming style.

I have several filters that users will want to be able to select.  I'm wondering if I shouldn't handle all of this on the SQL server.  I would have to create 2 temp tables (one with the cat 0 records and one with the cat 9 records).  Then I could create a query with any number of filters that the user wanted and return only the records that were needed.

That would eliminate all the client side processing, and ultimately give me more flexibility (especially since I'm more comfortable with T-SQL and CR)

Does this sound like a more logical approach to you ?
It does to me.  It is generally better to do the filtering on the server before bringing the records to Crystal.  In my method you would bring all the records to the report then process them and probably suppress many of them.  This would make the report run slowly since data transfer will be the slow point.

Putting the filtering on the server in the database will make the report run much faster.  

If you are dealing with small amounts of data you may not see any real difference.


SteveB2175Author Commented:

You have helped me twice today, I'm very grateful !!

You get the points again.

SteveB2175Author Commented:
Whoops, I accepted the wrong one, but I guess it doesn't matter.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.