The calculation for field totalcost would be (time/15)*10. You didn't state how you handle the amount if it was odd time such as 16 minutes. If you round up to the whole 15 minutes then you would use ceiling(time/15)*10.
And where do you put the $10 for every 15 minutes data? Will this be the same rate in every calculation or will other data specify a different rate for different records in the table?
And what time data do you have recorded and where?
Say you have these fields in the same table:
Your calculation might be:
Round ( Rate * (TimeEnd - TimeStart ) / ( 15 * 60 ) ; 2 ) //15 minutes times 60 seconds per minute
Round ( Rate * (TimeEnd - TimeStart ) / 900 ; 2 )
TimeEnd and TimeStart are best defined as time stamp fields so that the calculation remains correct even if TimeStart is before midnight and TimeEnd falls after midnight. If it's never the case that the elapsed time will be more than 24 hours and will never cross the midnight hour, you can use fields of type time instead of TimeStamp.
Subtracting one Time or TimeStampe field from another Time or TimeStamp field computes the elapsed time in seconds.
I have a field called "Total Time" that works correctly, my issue is that I want the field "Total Cost" to calculate the total time (in blocks of 15 min.) and then apply the total. So, if the total time is 0-14 min., the total cost would be $0.00, if the total time is between 15-29 min., the cost would be $10.00, if the total time is 30-44 min., the cost is then $20.00. I will try some of the tips that have been suggested so far and see if that works. Thanks for the input so far.
If Total Time is a a time field or returns total time in seconds:
Floor ( TotalTIme * Rate / 900 )
will compute the total cost, discarding any fractional amount less than a 15 minute interval.
Thanks Phil, that pretty much did the trick! Any tips on how to get FileMaker to produce dollars signs ($)? I added "" and () around the $10.00 part of the equation, but it only produces numbers. Thanks for all your help.
I'd use data formatting in the inspector to format this field as currency. Then the $ and a specified number of decimal places can be used to format the value of this field.
Cool, that works!! Thanks alot.