Joined: 26 Oct 2010
Online Status: Offline
Posts: 22
Topic: Running Total of a Formula Posted: 10 Jan 2013 at 7:23am
I am having trouble getting a running total to work on a formula.
I have a formula that rounds the amount of time on a time entry. My database has the time entry broken into 2 fields: tblTime.hours and tblTime.minutes. I also need to convert the hours to minutes. I have the conversion and rounding working but here's an explination of what is happening.
If tblTime.hours is 0, then I need @RoundedMinutes to always round up to 60 unless tblTime.minutes is also 0. If tblTime.hours in not 0, then @RoundedMinutes value should round up to 30 unless tblTime.minutes is over 30 in which case it should round up to 60. So, in a nutshell, 0hr 45min should = 60min, 1hr 10min should = 90min, and 1hr 50min should = 120min.
Like I said, that is all working. I would like to do a running total sum on that conversion. I've placed the formula field in the Details section so that it converts that particular entry. However, if I go to create the Running Total, my formula field is not listed in the available fields.
Is there a way to do a running total on the formula the way I have it set up? Or should it be in a different area of the report?
Joined: 26 Oct 2010
Online Status: Offline
Posts: 22
Posted: 10 Jan 2013 at 8:48am
Thanks for the reply. I am converting everything to raw minutes and the formula I am using to do the rounding is below. I will be taking the totaled minutes and convert and format the time as HH:MM as part of another formula later in the report. I'm just having trouble getting the Running Total to work in order to format it.
WhilePrintingRecords;
NumberVar TotalMinutes;
NumberVar RoundedMinutes;
If ({tblTime.hours} = 0) and ({tblTime.minutes} > 0)
Then RoundedMinutes := 60
Else If ({tblTime.minutes} <= 30)
Then If ({tblTime.minutes} = 0)
Then RoundedMinutes := 0
Else RoundedMinutes := 30
Else Roundedminutes := 60;
Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 10 Jan 2013 at 9:16am
well it seems you already have it set as a "manual" running total unless you are resetting TotalMinutes on another detail section (or a header/footer) somewhere else.
to get it to appear as an option to be used in crystal's standard runnnig total change it to
if {tblTime.hours}=0 and {tblTime.minutes}>0 then 60 else ceiling(({tblTime.hours}*60) + {tblTime.minutes},30)
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum