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

Calculating Formula Fields 1

Status
Not open for further replies.

Shnibnib

Vendor
Aug 9, 2005
4
GB
I have a formula field that converts the number of minutes to hours:

{DUR}/60

This is grouped (by day, but I think this is irrelevant)

I then have to take 30 minutes out of this sum if the total of the group is over 6 hours:

if Sum ({@DurDecHours}, {@LoginDate}) > 6 then
(Sum ({@DurDecHours}, {@LoginDate}) - 0.5)
else Sum ({@DurDecHours}, {@LoginDate})

I would then like to produce a grand total for the report of the above. I get a note saying that I cannot produce a summary field on this info.

Any help is much appreciated.
 
You will need to create a new formula using shared variables i.e.

Code:
{@SumOfHours} (Place this in whichever section contains your formula, can be suppressed)
WhilePrintingRecords;
Shared NumberVar TotalHours := TotalHours + {your formula name here);

Then create a 2nd formula to diaply the total

Code:
{@DisplayHours} (Place in report footer)
WhilePrintingRecords;
Shared NumberVar TotalHours;

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
I am now using this as a subreport, a user summary, in a detail section.

If I have multiple detail records produced as a result of running it against many people, the formula info above produces a running total across all details each time the preview is displayed.

e.g.
User A - 0.7
User B - 0.6
User C - 1.2

What I'm looking to do is have that total display across for that detail only

e.g.
User A - 0.7
User B - 0.1
User C - 0.6

It would be useful to be able to carry this total into another subreport in Details B which is another report, so that I can do a calculation, but I'm assuming that this is also a subvariable and will be easier once the above is correct.

Thanks!
 
Your example doesn't really convey what the problem is. You should describe your main report group structure, your subreport structure, and also how you have the subreport linked to the main report. Also explain where you are using the formulas Gary suggested.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top