Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Date Time Rate Calculation Help!

Featured Replies

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

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:

  • Author

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

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?

  • Author

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

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

  • Author

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

TimeStamp2.fp7.zip

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. :wink2:

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
Added 'whack' sentence :^)

  • Author

Thanks so much for your advise and help. :woohoo:

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:

  • Author

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

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
Added second sentence ...

  • Author

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

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. :wink2:

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

Edited by Guest
Removed file

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

  • Author

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?

Thank you for your time.

Thomas

Edited by Guest
Delete question

Hi Thomas,

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

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
Added update

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.