Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Enterprise
Expertise: Beginner
Jun 25, 1998



How to Help Your Business Become an AI Early Adopter

Dynamic Crystal Groups

Often, when adding Crystal reports to your system, you'll find that users want the same basic report grouped different ways, like sales reports by customer state or salesman or region, and so on. Don't code that report over and over--use one Crystal report to do all of them.

Add a formula to your report--lets call it Group1 for this example. Then add a group to your report. Instead of grouping on a database field, group on the formula Group1. Now, at runtime when you want to execute the report grouped by customer state, for example, change the value of formula Group1 to the name of the database field you want to group on. Using the Crystal object library in VB, the code might look something like this:

rept.FormulaFields.Item("Group1").Text = "{Customer.State}"
(The code using the OCX or Crystal designer will be similar)

Then run your report--presto! Your report is grouped by customer state.

David Lambert
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date