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.

Total time of records

Featured Replies

Hello there,

If anybody can help, it will be great. I have to fields: start and stop. each opening and closing of my database put a timestamp in the releated field. a calculation field (stop-start) count the time. how can i calculate the total time? Thanks for your help.

Dom

Hello Dom,

Result should be Time.

If( stop and start ; stop - start )

You can then format the field (through Field Behaviour) to display any way you wish; showing only minutes or hours. This will also wrap across days nicely.

:D

LaRetta

If( stop and start ; stop - start)

Try that with a Case() instead.

Hi Mike,

Can you explain your reasoning for not using If() here? I just want to understand your thinking on it. Thank you!

LaRetta

Sorry, I hadn't realized If() can handle a single result now. In prior versions you would need a Case() to do this. :D

No prob, Mike. Just wanted to learn new tid-bits if possible.

Yep, If() has come back into my favor. Heck, it's two less characters to type (or view) in calculations. It is limited to two possible results but it's still cute. I've been using FM for 3 years and have avoided If() almost entirely because of its prior requirement for a default result. It tickles me to again be able to use it freely. Short-circuiting is what really rocks my boat!

Thanks for clarifying. I'm always looking for deeper meaning and hidden jewels in everything. :crazy::grin:

L

  • Author

Thanks for your answer. But my problem is a total time for all the records, not only the time between the closing and the opening. Can you continue to help me?

Create a Cartesian self-join between the same table (where your time fields reside) - any fields (except graphics) using the X operator.

Let's call the above calc (in my first response) Diff. Then in your table, create this calculation:

Sum(selfjoin::Diff)

... also a time field.

If you need to convert this time field to full days, lets us know. :D

UPDATE: hold the boat ... I'm missing something here.

LaRetta

Sorry about that ... my results were going wonky. The above should produce what you wish. When in the calculation dialog, be sure to CHECK 'Do Not Evaluate if All Referenced Fields are Empty.' And be sure to use the If() test and not do what I did ... skip it on this final test and then watch it weird out when a start or stop is blank! :blush:

And my favorite emoticon is back!!

  • Author

Yesssssssssssssss It works perfectly! Last help (for today... i'm kiding) how can I convert this time field to full days?

You can get full days by changing your calc to =

Div ( Sum ( selfjoin::Diff ) ; 86400 )

Make sure you also change the result to Number.

Edited by Guest

  • Author

Thanks.

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.