Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Convert hour/minutes to units(days) Post Reply Post New Topic
Page  of 3 Next >>
Author Message
crystal_newbiee
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 15
Quote crystal_newbiee Replybullet Topic: Convert hour/minutes to units(days)
    Posted: 27 Apr 2009 at 6:42am
Hello everyone,

I was just wondering if anybody could help me.  I have a crystal report which currently reads the information in through a text file.  The text file has 2 separate number fields, hour and minute which are currently displayed as hour and minute. 

I need to display the fields as units, which works out as (4 units per day), so as 1/4 day = 1.75 hrs:  allowing for rounding, upto 2hours = 1 unit, upto 3 1/2hours = 2 units, 5hours = 3 units, 7 hours = 4units.  Thus meaning that 10days would equate to 40units.  I'm hoping to do this in 2 seperate formula fields on the report.  Any help would be great.

Thanks very much.




Edited by crystal_newbiee - 27 Apr 2009 at 6:46am
With power comes great responsibility!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Apr 2009 at 6:48am
can you post some sample data?
IP IP Logged
crystal_newbiee
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 15
Quote crystal_newbiee Replybullet Posted: 27 Apr 2009 at 6:56am
yeah sure. Will just get something.  Thanks
With power comes great responsibility!
IP IP Logged
crystal_newbiee
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 15
Quote crystal_newbiee Replybullet Posted: 27 Apr 2009 at 7:05am
"JobSheet","Status","AllocatedTo","AllocatedDate","EnteredBy","EnteredDate","RequiredBy","JobDescription","DevelopmentArea","Reportedby","ReportTitle","ReportSubTitle","Priority","CallType","Department","sort","EstimatedHours","EstimatedMinutes","Type","IncidentClass","Completed","Allocation Notes","Completion Notes","Rejection Notes","Days"
"00010334","Entered","","","KEVH","27/04/2009","","test 10","Unallocated","KEVH","job request by priority","",5,"Unallocated","IT","5","2","25","Unallocated","I","","","","",0
"00010333","Entered","","","KEVH","27/04/2009","","test 8","Unallocated","KEVH","job request by priority","",5,"Unallocated","IT","5","10","0","Unallocated","I","","","","",0
"00010332","Entered","","","KEVH","27/04/2009","","test 6","Unallocated","KEVH","job request by priority","",5,"Unallocated","IT","5","16","35","Unallocated","I","","","","",0
"00010331","Entered","","","KEVH","27/04/2009","","test 5","Unallocated","KEVH","job request by priority","",5,"Unallocated","IT","5","0","45","Unallocated","I","","","","",0
"00010330","Entered","","","KEVH","27/04/2009","","test","Unallocated","KEVH","job request by priority","",5,"Unallocated","IT","5","2","0","Unallocated","I","","","","",0
"00010329","Entered","","","KEVH","27/04/2009","","test","Unallocated","KEVH","job request by priority","",5,"Unallocated","IT","5","3","30","Unallocated","I","","","","",0
"00010328","Entered","","","KEVH","27/04/2009","","test","Unallocated","KEVH","job request by priority","",5,"Unallocated","IT","5","6","45","Unallocated","I","","","","",0
"00010327","Complete","","","KEVH","27/04/2009","","this is a test","Unallocated","KEVH","job request by priority","",5,"Unallocated","IT","5","1","1","Unallocated","I","","","","",0
With power comes great responsibility!
IP IP Logged
crystal_newbiee
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 15
Quote crystal_newbiee Replybullet Posted: 27 Apr 2009 at 7:05am
Is this ok?  Could not find anywhere to attach a txt file.  Thanks
With power comes great responsibility!
IP IP Logged
crystal_newbiee
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 15
Quote crystal_newbiee Replybullet Posted: 27 Apr 2009 at 7:07am
I guess it could all be done in one formula if possible?  Or if it makes it simpler, thanks again.
With power comes great responsibility!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 27 Apr 2009 at 7:09am
getting the hours, is easy, as I am sure you know.  It is the conversion as there appears to be a range of time that counts for each unit, not an exact amount which is going to make the conversion iffy, at least that is my initial impression.
IP IP Logged
crystal_newbiee
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 15
Quote crystal_newbiee Replybullet Posted: 27 Apr 2009 at 7:13am
Could it be rounded to the nearest hour maybe? i,e 3hours 25 mins would equal 2 units? If that makes sense? thanks 
With power comes great responsibility!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 27 Apr 2009 at 7:32am
you can create the hours by:
 
val({estimated hours}) + val({estimated minutes})/60
 
if you wanted to round, you could round on this result, or if you wanted to compare this, I would place the result into a local numbervar and reference it in formula.
 
This assumes that the fields are treated as strings and not numbers...it they are number, just drop the val() part.
 
IP IP Logged
crystal_newbiee
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 15
Quote crystal_newbiee Replybullet Posted: 27 Apr 2009 at 8:03am
The fields are treated as numbers, so would my formula for the field be: {OutstandingJobSheets_txt.EstimatedHours} + {OutstandingJobSheets_txt.EstimatedMinutes}/60.  I am quite new to this so I do apologise.  Also how do you actually round on the result?  Thanks again.
With power comes great responsibility!
IP IP Logged
Page  of 3 Next >>
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.