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!

Number Field Conversion - Help Please

Status
Not open for further replies.

keeno

MIS
Feb 24, 2006
33
GB
Hello

I have a Number field (Minutes.Duration) which is showing time in Minutes.

I need to convert this field to Hours.

However when i do that using the formula:

ToText({Minutes.Duration} \ 60, 0, "") & ":" & ToText(Remainder({Minutes.Duration}, 60), 0, "")

It shows the time in Hours (eg 8:42) but the field is now a String field.

However I need it to remain a Number field as i need to use this field in a bar chart.

How can I convert the original Number field (Minutes.Duration) to Hours but it remain a Number field,

I would appreciate any help you can give.

I am using Crystal Reports XI on a Oracle 10G Database

many Thanks
 
A number cannot contain a colon. Your formula should be:

round({Minutes.Duration}/60,0)+round(Remainder({Minutes.Duration}, 60)/100,2)

This will return a value such as HH.MM where HH is hours and MM is minutes.

If you want to display a colon here, format the field, go to the number tab and select customize, and replace the decimal separator with a colon.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Thanks for this. This has rounded the field up so 8:42 has become 9.

Is there anyway I can avoid this rounding up and it display the actual number 8.42 as a number

Appreciate your help on this

Thanks
 
Duh! Silly me for not catching this. Try this formula:

int({Minutes.Duration}/60)+round(Remainder({Minutes.Duration}, 60)/100,2)

Don't forget to format the field as I mentioned and this will return 8:42

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Thanks. However this formula has now rounded down to 8 and is 8:00 when i apply the colon formatting you mention.

Any ideas what i can do to keep the number as 8:42

Many Many Thanks For Your Help
 
This portion of the formula returns 8:

int({Minutes.Duration}/60)

This portion return 42:

round(Remainder({Minutes.Duration}, 60)/100,2)

Add them together and you get 8.42. format it as I suggested and you get 8:42. Please check your formula.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top