Hi Experts,
I have created a report that is taking the total times worked by each employee within a filter date and is summing up the total times for all the employees at the bottom.
Now i wanted it to total for each day up to sunday for each employee.
Something like in cloumn form.
Employee No. Employee name TotTime Mon. TotTime Tue. and so on to TotTime Sun.
Also the total time is giving something like 70.83 which is not logical in time. The .83 should not exit .60. Total time is a decimal datatype. I tried changing it to time so that the minutes time should not exceed 60min but its gives an error which runs like this:
The defination of the Total time was changed to
Old type:Decimal
NewType: Time.
When i complied it it still persist.
Also i have error on the formula that is subtracting the time in from the time out so that i can get the total time work for each day.
The error reads " time conversion error Decimal:=Time"
See my formula below which i placed in the time sheet table:
Time In - OnValidate()
IF "Time Out" <>0T THEN
"Total Time" :=("Time Out" - "Time In")/3600000;
Time In - OnLookup()
Time Out - OnValidate()
"Total Time" :=("Time Out" - "Time In")/3600000;
Any idea please.
Comments
"Type conversion is not possible because one of the operetors contains an invalid type" which shows Time:=decimal or Time:=Integer
This error will point to the below formula
Any ideas why?
"Reference to the member Total time of the variable could not be solved"
Its seems subtracting two time variables could only give a results of a decimal or interge type which will not be in line with the time rule. Will end up having more than 60mins in the minutes parts.
Any ideas please.
Changing datatype seems not to be working for me.
Any help Please?
Then you get the duration you need.
P.S. Patience is a virtue ...
I used your formula which runs thus:
Both "Time Out" and "Time In" have datatype called time.
cheers,
I have changed the data type of "Total time" to Time and Duration but its not allowing the subtractions of two times to take place. Its gives me the Errors i mentioned in my previous replies.
Right now the Subtraction could only take place when the "Total time" data type is decimal or integer and i wanted my results to be in time so that it can make sense.
Any idea please?
I do this:
And "Created Date-Time" is also a DateTime variable.
TAT as an output gives x Days, x Minutes, x seconds, x milliseconds. You can use the ROUND function to trim the output to your needs.
cheers,
newDateTimeIn := CREATEDATETIME(WORKDATE, "Time In");
newDateTimeOut := CREATEDATETIME(WORKDATE, "Time Out");
"Total Time" := newDateTimeOut - newDateTimeIn;
You'll need to check if Time Out is "before" Time In, then you'll need to change the date part of the Createddatetime function to one day later.
"Total Time" is a DURATION
newDateTimeIn and newDateTimeOut are DATETIME variables.
ROUND("Total Time",1000000); try changing by factors of 1000 (i.e. 1, 1000, 1000000, etc.).
I haven't actually got it to work the way I want to either, but the users are OK with it, so I stopped....
This is what your suggestion is giving me.
Any idea.
If you're using WORKDATE in the CREATEDATETIME function as I've outlined above, then Total Time should not have any days in it's value. If you've coded it like that, them I am as confused as you.
Are you sure "Time Out" > "Time In"? If it's not, then you'll need to increase Workdate by 1 in your CREATEDATETIME statement (code is untested):
Any other idea?
http://www.mibuso.com/forum/viewtopic.php?t=15655
cheers,
How can i round it in hours only.
Thanks.
Or maybe one of the other more experienced developers has a solution?
cheers,
Thanks.
Thanks.
So if you divide the Duration by 1000*60*60 (milliseconds*seconds*minutes), you effectively get the number of hours.
I also wrote this on my Report:
I do have the "Total Time" in hours, but when i some the in the report as shown above i get 1 day 9hours when actually i what it to give me the sum in hours say 33 hours. i have tried things like
TotalTime += "Total Time"*24; it gave me 33 days instead of hours
TotalTime += "Total Time"/24; this give me 1hour 22minutes
TotalTime += "Total Time"/(1000*60*60); this give me 33miliseconds.
I still did not have what i want.
Any suggestions Please?
Thanks
Have you tried using the datatype of TIME instead of DATETIME?
or is it possible to convert the datetime into a time???
2 days = 48 hours :-k
http://www.BiloBeauty.com
http://www.autismspeaks.org
I.e "Total Time" := "Time out" - "Time In"; Gives errors. Its not allowing the subtraction. The "Total time" has to be either decimal datatype or integer datatype.
This is why i took the suggestion of CobaltSS which is to use datatime, which is close to my solution, but having problems of converting to hours only.
Any idea?
Can somebody help me out with this Please.
If you still can't get it to work, ask a senior programmer at your company to help you. If you're an end user, ask your NAV partner to help you. It will save you a ton of frustration and time.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book