# Date Time Rate Calculation Help!

This topic is 5589 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

Can someone guide me in the right direction. I have here a small sample of date time rate calculation I need help with. I assume to convert the date into hours and the hours into seconds and then calculate the rate. I'm really lost, how should I start approaching this?

Thanks

TMAS

TimeStamp.fp7.zip

Edited by Guest
##### Share on other sites

Yes of course. Where is the break-point? Do you round up or down at the quarter hour, for example? First thing I would suggest is to use true Timestamps here - it would make it much easier for you and save two fields. But I can give you a specific answer once I know the critieria (the rules) for the rate. :wink2:

##### Share on other sites

Rules for the rate? Sorry I dont understand.

For the hour I would think round up..? Is it not possible to calculate the Total Amount of Hours Minutes spend or even better have the option (Checkbox) to turn round up, rown down on and off? Hmm. Let me know what info you need and thabks for your help on this!

TMAS

##### Share on other sites

Example of rules:

Rate is \$25 per hour. If the duration was 1 hour 30 minutes, do you charge \$25 + \$25/2? Or if 15 minutes remaining, 25/4?

##### Share on other sites

That sounds good, I'm open for any help in this case. Quater hour is fine. Just wonder is it possible to calculate it by the minute, without rounding up or down?

TMAS

##### Share on other sites

Poop. I deleted my own post. Here it is again...

What I was saying is that you have pieces: EndDate, EndTime, StartDate and StartTime scripted. It is resource-wasteful. If you use Timestamps, it is easier for your Users and timestamps work better for addition/subtraction. Here's the file again. Your dollar result appears in the yellow field.

TimeStamp.zip

##### Share on other sites

Thanks for your help in the meanwhile I came up with this, wired but works. Let me see your file....

TimeStamp2.fp7.zip

##### Share on other sites

I see it as this ... your 9 calcs compared to my 3. I hate adding fields if I don't need to. And each evaluation (over the duration of your file) will slow it down. In addition, timestamps can easily be used for summing, Min() and Max() and other things. They are VERY sweet.

As you can see, I cheated and used your EndDate etc in my timestamps. But you can SET these fields via script in one whack!!

Edited by Guest

##### Share on other sites

BTW, none of those calcs in my file need to be unstored. I always unstore when I'm working - old (possibly bad) habit.

But I always remember to change them before implementing into any solution. :smile2:

##### Share on other sites

Whats the purpos of unstored? Is it for the Auto Complete function?

##### Share on other sites

When I'm changing data in several fields - and if I use globals, related fields or a Get() function, the calculation must be unstored. It isn't needed for any of these calcs because the fields they reference (within the calculation) are within the same record.

But I've been testing calcs (which use related fields etc) which DIDN'T change and I've thought something was incorrect in my syntax. It's cost me time. So I started unstoring all calcs I was testing. I ALWAYS remember to set them properly in a solution (because I also set the index options individually).

Edited by Guest
##### Share on other sites

I have one more problem if you dont mind helping me.

I try to get this solution a step further. If you look at the attached file you'll see I try to achieve a additional portal and pause solution. For example the user presses pause to stop the timing, than it should create a entry of the pause in between with description, like in the file. Any clues on this one? Basic Idea. Set Start of Project, pause when needed, description of what done till the pause and after pause resume the job. Does that make sense? Thanks for your help!

TimeStamp_2.fp7.zip

Edited by Guest
##### Share on other sites

You changed your file? Well here's the one I worked on. A few comments and roughly what I did.

• Switched you to timestamp fields which deleted 11 fields.
• Deleted the timestamps from your main file - we will store all times right within the newly created start/stop records instead, saving 4 fields.
• Allowed for multi-user mode and multiple Users entering work for one record.
• Changed the calculation to one Comment suggested - I liked it better.
• Built in some User protections from entering a new record when they hadn't finished Ending the prior one.
• Sorted base [color:red]relationship so most current is in top. If there are many entries, the latest entry will be the one a User needs to view.

See how you go with it; I'm not supposed to be playing today. If I missed the ball completely, maybe others can help you, but I truly dislike the idea of using a paused script and I saw no reason that they couldn't click the End just as easily as clicking a Pause. With the visual display of the portal right in front of them (and protections from starting again if they haven't stopped first), I saw no reason for it. I hope it is helpful.

[color:green]The file is below. I corrected for rounding and added a display message for the status.

Edited by Guest
Removed file
##### Share on other sites

Here's a tested example. Each start creates a related record. Each stop requires a reason. And the rounding is as you've requested now. There is no need for a second portal. The Custom Dialog for the reason probably isn't necessary because they can just type the reason in the top portal. I left it in because I was unsure of your process and thought you might want to control it further, ie, refuse to stop without a reason. That can be controlled within the script.

TimeStampREV.zip

##### Share on other sites

Wooow this rules, Thats pretty amazing a few calculations making all of this. How about if someone wants to clear the entry, would you say shust a simple delete portal row in this case?

Thomas

Edited by Guest
Delete question
##### Share on other sites

Hi Thomas,

Yep, simply deleting a row will change the time totals. Glad it was helpful.

UPDATE: Keep in mind that a deletion will not reflect any time used during that StartTimeStamp and EndTimeStamp period but I assume you understand that.

Edited by Guest
##### Share on other sites

This topic is 5589 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account