Click to See Complete Forum and Search --> : Running Total Formula


krusty678
December 28th, 2005, 12:58 PM
Hi Y'all,

I have a formula that I am trying to use to create a sub-total for each group in a report.

For a field called billcode_name I am trying to separate the "Regular Bill" and "Travel" instances from the rest of the billcode names. I already have a sum that is adding the totals for these entries which is why I have to create a formula.

My code is as follows:

WhilePrintingRecords;
NumberVar totalb := 0;

If ({clientbreakdown_ttx.billcode_name} = "Regular Bill") OR ({clientbreakdown_ttx.billcode_name} = "Travel") Then
totalb := totalb + {clientbreakdown_ttx.task_dur}
Else
totalb := totalb;

totalb

This only adds the last sum to the total. Is there some sort of loop which will add both the "Regular Bill" and "Travel" to my totalb variable so I can display it?

Thanks in advance.

Silly Star
December 29th, 2005, 07:01 AM
please make ur query a bit clear so that i can give u closer solution to u.
do u want to calculate seperate sum for each.
or want to have combined sum etc etc

Thanks

Silly

krusty678
December 29th, 2005, 10:28 AM
Hi Silly Star,

Yes , just total each for billable and non-billable items. But how do I sort?
It's supposed to look like this:

BILLCODE NAME BILLABLE HOURS NONBILLABLE HOURS

krusty678
December 29th, 2005, 10:32 AM
Hi Silly Star,

Yes , just total each for billable and non-billable items. But how do I sort?
It's supposed to look like this:

BILLCODE NAME BILLABLE HOURS NONBILLABLE HOURS

Regular Bill 8.5 0.0
Travel .5 0.0
Meeting 0.0 1.0
Research 0.0 3.0

Total 9.0 4.0

How do I sort through the varios billcode names and total the billable and nonbillable hours?

Thanks.

krusty678
December 30th, 2005, 12:15 AM
Hi Silly Star,

I solved my problem by putting the functions in the user defined funtions of the SQL Server database. Then the functions are included as fields in the query and can be manipulated by the IDE of Crystal Reports. Thansk for your help.

Krusty678