Thursday, March 22, 2012

Create a Formula to Represent Shift

I have 4 fields that I need to create a formula on that shows as Shift 1 and Shift 2 the fields are

Type: String

Shift1begins="06:45" Shift1Ends="19:15"

Shift2begins="18:45" Shift2Ends="07:15"

My intention is to create a formula for a report so that I can use the Shift1 and Shift 2 as parameter choices in my report. Can you help?

Thanks!Can you give alittle more information as to what you need the formulas to do? Do you want to pass the work "Shift1" and have Crystal know that it means between 06:45 and 19:15? Or do you want to pass a time and have Crystal tell you what shift it fall under? Or something totally different?|||My report is a productivity report on our Therapists. Some work from 6:45 am to 7:15P this is shift 1. Shift 2 works from 6:45 pm to 7:00 am.

There are 4 fields that represent the times that are in shift 1 and 2 the beginning time and the endtime. My report has a date parameter that allows me to pull a range of data for our Therapists but it doesn't pull the correct data for the night shift because there is no way to specify the shift times. The report consists of

Therapists Name
Dates Worked
Daily Productivity for each day
Productivity Average for each month.

Day shift works fine cause it doesn't span two days. Night shift is inaccurate because it only calculates the time for the one date entered and doesn't allow for the time that scales both days. So I figured that if I set up a parameter based on the shift that this would work. I added the table that has the field in it to the report (which is a canned report anyway) and tried to create a parameter but I am not doing it correctly and that is what I need help with. Thanks!|||Originally posted by Shiloh917
My report is a productivity report on our Therapists. Some work from 6:45 am to 7:15P this is shift 1. Shift 2 works from 6:45 pm to 7:00 am.

There are 4 fields that represent the times that are in shift 1 and 2 the beginning time and the endtime. My report has a date parameter that allows me to pull a range of data for our Therapists but it doesn't pull the correct data for the night shift because there is no way to specify the shift times. The report consists of

Therapists Name
Dates Worked
Daily Productivity for each day
Productivity Average for each month.

Day shift works fine cause it doesn't span two days. Night shift is inaccurate because it only calculates the time for the one date entered and doesn't allow for the time that scales both days. So I figured that if I set up a parameter based on the shift that this would work. I added the table that has the field in it to the report (which is a canned report anyway) and tried to create a parameter but I am not doing it correctly and that is what I need help with. Thanks!

Hi,

If your fields contains datatime datatype you can calculate enddatetime - startdatetime that returns the value of number of seconds difference.|||No that doesn't work. I have date parameters that I have tried changing to "datetime" datatype but it works fine for day shift but on night shift it will not calculate correctly. You see our Therapists on Night shift come in at 6:45 pm and they get off at 7:15 am so they may come in for example on 02/10/04 and their shift will end on 02/11/04. That is why I figured if I use the shift field which is already a pre-filled value at 6:45 pm and 7:15am to represent shift 2 (made up of of two fields which say Shift2Begins and shift2Ends) that I might be able to get the correct data. I guess there is just know way to do this then. So thank you anyway. I appreciate your efforts.

Shiloh|||Originally posted by Shiloh917
No that doesn't work. I have date parameters that I have tried changing to "datetime" datatype but it works fine for day shift but on night shift it will not calculate correctly. You see our Therapists on Night shift come in at 6:45 pm and they get off at 7:15 am so they may come in for example on 02/10/04 and their shift will end on 02/11/04. That is why I figured if I use the shift field which is already a pre-filled value at 6:45 pm and 7:15am to represent shift 2 (made up of of two fields which say Shift2Begins and shift2Ends) that I might be able to get the correct data. I guess there is just know way to do this then. So thank you anyway. I appreciate your efforts.

Shiloh

use this following functions in the crystal report formula field.

datediff ("h", DateTimeValue (2004,04,26,20,0,0),DateTimeValue (2004,04,27,1,20,0))

No comments:

Post a Comment