Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: String Time To Decimal Post Reply Post New Topic
Author Message
adrinef
Newbie
Newbie


Joined: 09 Apr 2010
Online Status: Offline
Posts: 2
Quote adrinef Replybullet Topic: String Time To Decimal
    Posted: 09 Apr 2010 at 7:04am
I'm working on a weekly payroll report which shows hours worked for each day, if will show regular time, ot, vacation, sick, holiday.  The View that the report is pulling from is populated from our erp system.  When vacation, sick, or holiday hours are used it does not put it in a column  on the right it will put it in the clock in-out column and populate it with a text string like this. "  8.45-PAID". It has two leading spaces.  Also everywhere else in the report the minutes are displayed as a decimal not in minutes. 
The report has columns for Regular time, Overtime and Double, I took the double out and I'm trying to set it up like this
Regular time, Over Time, Holiday, Vacation, and Sick.


I've been able to extract the 8.45 by using
ToNumber(Mid({V_BI_TIME_CARD.EC1_DTL2},3,4)) which gives me the 8.45. but I'm stuck on trying to  extracting the minutes out and converting it to decimal and putting it back together.

Also the particular field also contains other information depending on the record type field, like ""(empty), 8.45-Paid, 8.75 HRS(Uses for totals not single day), 12:00:59, 12:05:55, etc.

So I only want to do this when the record type equals a particular number for example,

For Sick Time

If {V_BI_TIME_CARD.EC1_CODE} = "02" Then

ToNumber(Mid({V_BI_TIME_CARD.EC1_DTL2},3,4))

Else 0.00


Holiday the code would equal "04".
So if someone could help me take the 8.45 or whatever it is for the day and convert the minute value to a decimal so that i can use it to total up the row that would be great.







IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 09 Apr 2010 at 8:34am
Try:
 
If {V_BI_TIME_CARD.EC1_CODE} = "02" Then
ToNumber(Mid({V_BI_TIME_CARD.EC1_DTL2},3,1)) +
ToNumber(Mid({V_BI_TIME_CARD.EC1_DTL2},5,2))/60
Else 0.00
IP IP Logged
adrinef
Newbie
Newbie


Joined: 09 Apr 2010
Online Status: Offline
Posts: 2
Quote adrinef Replybullet Posted: 12 Apr 2010 at 11:53am
Thank you, it worked.  I might need help later with totaling it with other fields but I'll cross that river when I get there.

Thanks Again.

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
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



This page was generated in 0.031 seconds.