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

Group Formula

Status
Not open for further replies.

LadyJAG

Programmer
Apr 14, 2004
12
CA
I am using Crystal 8.5 with an ODBC connection to an Oracle database. I'm having a problem with some formulas that determine if a specific type of service has been found in a group and changing the number of decimal places in the subtotal in the group footer if they have been found.

In the detail records I'm changing the number of decimal places if required but I can't get it to work in the subtotal or grand total.

The data looks like this

ServiceRequestor Location ServiceType Quantity
Company1 a FT-R 100.2
Company1 a CO2 .1234
Company1 a FT-D 200.0
Company1 a CO2 .3456
Company1 b FT-R 100.2
Company1 b FT-R 50.0
Company1 b FT-D 200.0
Company1 b FT-D 27.2

The report is formatted like this:

GH1 - ServiceRequestor
GH2 - Location
Detail
GF2 - Location Sub Total
GF1 - Service Requestor Grand Total

I need the Location Sub total to display with 4 decimal places if a detail record with service type CO2 has been found in the group and 1 decimal place if no CO2 was found. The Grand total needs to display with 4 decimal places if a detail record with service type CO2 has been found in any location in the report.

Any help would be appreciated.
 
Dear LadyJag,

Well, it seems you need a formula to count the occurance of CO2.

//@cntco2

if {Table.ServiceType} = 'CO2'
then 1
else 0

Place in the detail section (you can suppress so that it doesn't show), right click and insert a summary for the group and a summary for grand total.

Now, in the GF2 subtotal, right click, format field, number tab, customize, decimals x-2 formula editor and enter the following formula:

if Sum ({@cntco2},{Table.FieldIgroupedOn}) > 0
then 4
else 1


Now, onw the summary in the grand total repeat the steps above, but change the formula to:

if Sum ({@cntco2}) > 0
then 4
else 1

Regards,

ro


Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Thanks so much rosemaryl, that worked perfectly!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top