?
Solved

How do I specify selection criteria in Crystal Reports ?

Posted on 2007-10-16
7
Medium Priority
?
250 Views
Last Modified: 2013-11-26
This is a follow up to a previous question
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_22896000.html

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.
0
Comment
Question by:SteveB2175
  • 4
  • 3
7 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 20087846
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.

mlmcc
0
 

Author Comment

by:SteveB2175
ID: 20087942
mlmcc

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.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 20088139
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;
boolSuppress

mlmcc
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

Author Comment

by:SteveB2175
ID: 20088188
Hmmmm,

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 ?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 20088298
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.

mlmcc

 
0
 

Author Comment

by:SteveB2175
ID: 20088334
Thanks,

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

You get the points again.

-Steve
0
 

Author Comment

by:SteveB2175
ID: 20088341
Whoops, I accepted the wrong one, but I guess it doesn't matter.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

840 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