Hi,
I'm doing some reports which involve a lot of time manipulations and am finding that some of my time summations are rounding up. I have to do summing, totals, averages and grandtotals on time fields. I'm OK on averages but the rounding up on totals and grandtotals looks funky. This is how I'm been handling time fields (definitely not my speciality although I've been tasked with it):
First I create a formula which contains the following:
@duration in secs
mission.duration - time(0,0,0)
Then in a running total I do the summary function.
#Sum Act duration
Field to summarize: @duration in secs
type of summary: sum
Evaluate on chg of field: Mission.mission_id
Reset on chg of group: Group#2 current date
Then I plop the running total in a formula
numberVar sumofduration := {#Sum Act duration};
numberVar vhr := int(sumofduration/3600);
numberVar vrem := remainder(sumofduration,3600);
numberVar vmin := int(vrem/60);
vrem := remainder(vrem,60);
numberVar vsec := int(vrem);
stringVar colon := ":";
stringVar vshr := IIF(vhr<10,"0"+ToText(vhr,0),ToText(vhr,0));
stringVar vsmin := IIF(vmin<10,"0"+ToText(vmin,0),ToText(vmin,0));
stringVar vssec := IIF(vsec<10,"0"+ToText(vsec,0),ToText(vsec,0));
stringVar timestring := vshr+colon+vsmin+colon+vssec;
What am I doing wrong?
Thanks for all your help.
Jacque
I'm doing some reports which involve a lot of time manipulations and am finding that some of my time summations are rounding up. I have to do summing, totals, averages and grandtotals on time fields. I'm OK on averages but the rounding up on totals and grandtotals looks funky. This is how I'm been handling time fields (definitely not my speciality although I've been tasked with it):
First I create a formula which contains the following:
@duration in secs
mission.duration - time(0,0,0)
Then in a running total I do the summary function.
#Sum Act duration
Field to summarize: @duration in secs
type of summary: sum
Evaluate on chg of field: Mission.mission_id
Reset on chg of group: Group#2 current date
Then I plop the running total in a formula
numberVar sumofduration := {#Sum Act duration};
numberVar vhr := int(sumofduration/3600);
numberVar vrem := remainder(sumofduration,3600);
numberVar vmin := int(vrem/60);
vrem := remainder(vrem,60);
numberVar vsec := int(vrem);
stringVar colon := ":";
stringVar vshr := IIF(vhr<10,"0"+ToText(vhr,0),ToText(vhr,0));
stringVar vsmin := IIF(vmin<10,"0"+ToText(vmin,0),ToText(vmin,0));
stringVar vssec := IIF(vsec<10,"0"+ToText(vsec,0),ToText(vsec,0));
stringVar timestring := vshr+colon+vsmin+colon+vssec;
What am I doing wrong?
Thanks for all your help.
Jacque