Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Group by parameter 1

Status
Not open for further replies.

adhhealth

Programmer
Jul 1, 2004
165
US
crystal version 8 pervasive sql version8.
Hi,
I have 3 reports which have the same information but grouped by different following fields in the database in each respective report:
1.customer
2.product
3.quantity

can i have just one report which could take a parameter which groups by any one of the above and prints the report?
ie. user at the time of running the report can specify how the records should be grouped by say by customer. and so on..
 
You can create a formula to do this, then group on the formula, but all 3 fields would either have to be the same datatype, or be converted as such.

What are the datatypes?

For example, if Customer and Product happen to have a key field that is numeric (presumably, Quantity is already numeric), you could create a formula like the following, then create the report's group on this formula:

//@Group
If {?GroupBy} = 'Customer' Then
{Table.CustomerID}
Else If {?GroupBy} = 'Product' Then
{Table.ProductID}
Else
{Table.Quantity}

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top