FM Bash! Posted June 5, 2006 Posted June 5, 2006 I need to have a calulation that will return a value of "0" if the read value is -.25 or less, but then display the total values after this amount. ie: Employee gets 15 minute break paid. Any time over the 15 munutes will be deducted. My atempt at this, though I know it is not correct: Break 1 grand total = Break 1 total If(Break 1 total < -.25, 0)
Genx Posted June 5, 2006 Posted June 5, 2006 I am so confused where the -.25 comes in... FM6: If(Break < 15 or Break = 15 , 0 , 15 - Break) Note that you can condense the statement more by using the less than or equal to sign instead of the Break < 15 or break = 15. In english the calculation says: If the break is less than or equal to 15, set value to zero. Otherwise show me the amount of time gone over the break. Anyway, the example should help you work out what your looking for.. As a charging for over break time sort of thing.. Net Income = Income + ( If(Break < 15 or Break = 15 , 0 , 15 - Break) * BreakOverRunRate )
FM Bash! Posted June 5, 2006 Author Posted June 5, 2006 This caculation breaks time into decimal system. 15 minutes = .25, 30 min. = .5. By using -.25 on the end, "The Break 1 total" will result in a negative number until 15 minutes. At that time, positive numbers begin as break time that will be taken out of the employees total time. Break 1 total= Round(Hour( End Break 1 - Start Break 1 ) + Minute( End Break 1 - Start Break 1 ) / 60 - Lunch fake,2)+If(End Break 1 <= Start Break 1,24,0)-.25 I have created the "Break1 grand total" so it can be use for calculating an employees total break time adding, "Break 1 grand total" + "Break 2 grand total" + "Lunch break total" to = "Total break time". This is why I need Break totals to return display "0" until -.25 has been past.
Inky Phil Posted June 5, 2006 Posted June 5, 2006 If this is for a calc field (and if I have understood you correctly) then try Case(Break 1 total > -.25;0;Break 1 total) In the case that Break 1 total is greater than -.25 this will return a 0. In all other cases it will return the value of Break 1 total Phil
FM Bash! Posted June 5, 2006 Author Posted June 5, 2006 (edited) Ok, I have changed the colons to commas and this works for displaying "0" for the negative number test. But it does not display numers over the negative -.25. It only displays "0". Case(Break 1 total > -.25,0,Break 1 total) Edited June 5, 2006 by Guest
Inky Phil Posted June 5, 2006 Posted June 5, 2006 Hi Bash I just tried it in case I had given you duff info but it works in mine. I presume that there is something a bit flaky about the format you have used that leads it to believe that is looking for a field. I cannot see what is wrong with what you have displayed here but you mention 'after the colon'. That colon should be a semi-colon as you have here. Other than that the structure for a simple case calc such as yours is as follows Case(condition you want to meet;result of condition being met;result if condition not met). All that said I have just noticed that you are on FM6 ( i was sure I had checked) and I think that the colon/ semi colon issue changed after 6. Look it up in your help file. Other than that the structure is the same. HTH Phil
Inky Phil Posted June 5, 2006 Posted June 5, 2006 Sorry bash we are a bit out of synch here. I was doing my last post as you were doing yours so take no notice of the colon thing. Other than that the syntax I gave you in my last post might help you come up with a structure that gives the result that you want. Phil
FM Bash! Posted June 5, 2006 Author Posted June 5, 2006 (edited) Hi Phil, FM6 just will not recognize the simi-colons. I pasted your script and still have the same problem. I'll try to clarify how I am using my fields. As I input time into the clock, say 10 minutes, the result return is -.08 in my Break 1 time field. This field would not be visiable to the user. The Break 1 grand total would be what the user would see, and be used in the Total break time field. Case(Break 1 total > -.25,0,Break 1 total) This works for returning a "0", but only "0". It does not pick up after -.25. Also, thank you for your patients on this matter. Don Edited June 5, 2006 by Guest clarifiy
Inky Phil Posted June 5, 2006 Posted June 5, 2006 Hi Don Thank you for the clarification. I am going to bed now (uk). I only popped in to see how you had gotten on. I will look at this as soon as I get into work in the morning and it should be ready for you when start work. Phil
Lee Smith Posted June 5, 2006 Posted June 5, 2006 I'm sorry, I'm confused to what you are doing and what you want as a result. I read it this way, 15 min = .25 of an hour If they take a break of .25 or less, Break Field to be 0? If they take more than .25, then you want to charge them for the differene. i.e. .50 - Break = -.25 If so, I think this will do it. Case( Break ≤ .25, 0, Break > .25, .25 - Break) If not, maybe break out what you are wanting for the result. HTH Lee
Genx Posted June 6, 2006 Posted June 6, 2006 Lee isnt that Break > .25 evident in the fact that break is not ≤ .25 ? I liked the pun btw :. ~Genx
FM Bash! Posted June 6, 2006 Author Posted June 6, 2006 Genx, It is "Break 1 grand total" that is evalulating "Break1 total". As stated in my last entry, It will result in "0", but the problem is after "0" it will not pick up and continue with positive numbers. Thank you for your interest. I'm dieing to complete this. Don
FM Bash! Posted June 6, 2006 Author Posted June 6, 2006 (edited) All is solved!! Yah. Here is the deal. Lee Smith wrote: Break 1 grand total= Case( Break ≤ .25, 0, Break > .25, .25 - Break) I edited the last part to remove .25 after 0. Case( Break 1 T ≤ .25, 0, Break 1 T > .25, Break 1 T - .25) This worked, but I also had to remove the last statement in my script for "Break 1 total" (-.25) you see at the end. Round(Hour( End Break 1 - Start Break 1 ) + Minute( End Break 1 - Start Break 1 ) / 60 - Lunch fake,2)+If(End Break 1 <= Start Break 1,24,0)-.25 I want to thank everyone who was so kind to share their skills with others. Time is relevant to the space in which it occupies. Please chaeck out my website to hear my peaceful and relaxing acoustic and classical guitar instrumentals. Completely original, positive work music. donthomasmusic.com Cheers!!! Don Edited June 6, 2006 by Guest
Inky Phil Posted June 6, 2006 Posted June 6, 2006 Morning Don Please correct me if I am wrong but what you have is: A field ( break 1 total) which calculates, according to the clock, how long someone is on their break. It starts at -.25 so that when it gets to 0 they should either have finished their break or will be going into time for which they should not be paid. You then want a calculation to tell you how long, if at all the person has gone over their allowed (15min) break. If I am correct so far try this: Case(Break 1 total>0;Break 1 total;0) This should return the value of Break 1 total (in decimal format) if it is greater than 0 (and therefore is excess time) or 0 if the person ends their break before or at 15 mins With regard to the colon/ semi colon issue I cannot remember what 6 uses whether it be a full colon or just a comma. Please look it up in your help files before using the calc. Hope that helps Phil
Inky Phil Posted June 6, 2006 Posted June 6, 2006 Ignore that last post. It was just me stumbling through the forum in my accustomed clumsy manner. I didn't realise there was a second page and that all had been resolved Oops! Phil
Recommended Posts
This topic is 6807 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now