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

ToText evaluates the same number differently. 1

Status
Not open for further replies.

Crewdawg

Technical User
Oct 29, 2005
30
US
I am running CR 10 on SQL2000 via OBDC.

I have a report which summarizes times for payroll. I use the following formula to convert the database text field which stores the time in the hh.mmm format into minutes.

Code:
(truncate({TIME_DURATION})*60)+(({TIME_DURATION}-truncate({TIME_DURATION}))*100)

Then ActTimeConv is evaluated with a running total ({#1EmpActT}). This running total in minutes is then converted back to hours and minutes by this formula.

Code:
if isnull({#1EmpActT}) then
"00:00"
else
totext(truncate({#1EmpActT}/60),"00")+":"+totext(remainder({#1EmpActT},60),"00")

I have two persons on this report (which is grouped by employee code) both with a total of 2400 minutes for the week (aka 40 hours). One individual displays as 39:60, the other as 40:00.

The image below is a picture highlighting what I have found. The blue text is the running total output ({#1EmpActT}).


repexample1.JPG


What causes Crystal to evaluate the same number (2400) differently for those two lines and what can I do to prevent this from happening.

-Sean H
----------------------------------------
Multithreading is just one thing after, before, or simultaneous with another.
 
The actual value that you are showing as 2400.00 might be, e.g.,2399.9999. I think you could just change your formula to:

if isnull({#1EmpActT}) then
"00:00"
else
totext(truncate(round({#1EmpActT})/60),"00")+":"+totext(remainder(round({#1EmpActT}),60),"00")

-LB
 
Thank you for the suggestions. The round function has resolved my problems.

-Sean H
----------------------------------------
Multithreading is just one thing after, before, or simultaneous with another.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top