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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Grouping based on conditions of a field 2

Status
Not open for further replies.

Charley71

Technical User
Aug 17, 2007
31
US
I am having trouble getting a report to group sections based on conditions that I set. I think I just don't know how to do this and am hoping it is easy. I want to have my report tell me how many accounts fall within a range of usage based on megabytes. For example: I have two fields on my report called Account and TotalMegs. I want to have a count of Accounts that fall with in a range of totalmegs usage that I specify. I will have 14 different ranges of TotalMegs. I am using crystal reports 11. I hope this all makes sense. Thanks.

Example:

TotalMegs =0
count of accounts
TotalMegs > 0 and < 2.0
count of accounts
TotalMegs >= 2.0 and < 4.0
count of accounts
(and so on)
 
Hi There,

Please Note - I'm using v10, so hope this applies to V11 aswell.

If I understand this right, you want to group by the total Megs field, but in the ranges you specify, not by each Total Megs value.

Have you tried creating the group using the Total Megs field, but then you sort the group by SPECIFIED ORDER (its in the drop-down list that shows "Ascending Order" as default).

When you select SPECIFIED ORDER, you get another tab where you can input the details of your specified order.

Click on NEW, and you'll be prompted to enter a formula using the drop down list of ranges (ie less than, more than etc).

Just select what you want, (ie is equal to 0; is greater than 0 and less than or equal to 2.0; etc etc), and keep creating new formulas until you have satisfied all your grouping levels. The name that displays on the group is the name of each of those formulas you create, and it displays in the order you have the formulas in aswell.

Then just do the required counting summary (Count or Distinct Count)on the Account field to get the total in the group footer of each group level.

Hope this helps
 
If Total Megs is an actual database field, you can create a formula like this:

if {table.totalmegs} < 2 then "00.0 to 01.9" else
if {table.totalmegs} < 4 then "02.0 to 03.9" else
if {table.totalmegs} < 6 then "04.0 to 05.9" else //etc.

This is essentially the same as the earlier suggestion, though easier, I think. Then insert a group on this formula. You can then right click on the account field in the detail section and insert a distinctcount on it at the group level.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top