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.

Need help getting a repeating calc to work

Featured Replies

Ok, back when I first started my table the standard calculation of end/start worked fine as a repeating value.

 

now that i want to use this time showing function from another "solution" I can't get it to output correctly.

it will only show the last repetition i entered and won't repeat to the other values.

i know there is a simple solution, but i am at a loss.

Let ( [ $end = GetRepetition ( END ; Get ( ActiveRepetitionNumber ) ) ; $start = GetRepetition ( Start ; Get ( ActiveRepetitionNumber)) ] ;  Round(
Hour( $END -
$Start ) + Minute( $END - $Start) / 60 - BREAKS;2)+
If(
GetAsNumber($END) < GetAsNumber($Start);
24;
0))

Why are you not posting this followup question to your original post?

  • Author

Didn't realize my original post was the correct one. sorry about that

I don't think it's possible to understand your question. Instead of posting a calculation that doesn't do what you want, you should start with what you have (which fields will the calculation use as its input, what are their types, and what do they represent) and then explain what do you want to actually calculate.

If I dare to venture a guess: supposing you have two repeating Time fields named Start and End, then a calculation field, with its result type set to Time, and the number of repetitions to (at least) the same number of repetitions as the two input fields =

End - Start

will return - in each repetition - the duration calculated using the start and end times in the corresponding repetitions of the input fields.

it would be probably better to use individual records in a related table instead of the repeating fields.

Let ( [ $end = GetRepetition ( END ; Get ( ActiveRepetitionNumber ) ) ; $start = GetRepetition ( Start ; Get ( ActiveRepetitionNumber)) ] ;  Round(
Hour( $END -
$Start ) + Minute( $END - $Start) / 60 - BREAKS;2)+
If(
GetAsNumber($END) < GetAsNumber($Start);
24;
0))

This calculation is very hard to read. May I suggest for future posts that you add a bit of formatting to your calculations? E.g.

Let ( [
  $end = GetRepetition ( END ; Get ( ActiveRepetitionNumber ) ) ;
  $start = GetRepetition ( Start ; Get ( ActiveRepetitionNumber ) )
  ] ; 
  Round ( Hour ( $END - $Start ) + Minute ( $END - $Start ) / 60 - BREAKS ; 2 )
  +
  If ( GetAsNumber($END) < GetAsNumber($Start) ; 24 )
)

Now at least it is is (better) readable, and problematic areas can be spotted more easily.

PS: You shouldn't declare $vars in Let(), unless you know what you're doing.

  • Author

When it was just the straight Time /end calculations, the fields worked. When i try to use the rounding formula all hell broke loose. if i changed the /let code to a function, would it go back to operating the way i wanted?

( i had it originally as if end < start; 24+End-start;end-start (With hour (start) (hour(end) being used. It worked as I intended.  - but then it wouldn't show the partial times.

As for the variables I didn't want to create another cell to do the calculations i needed.

 

 

if i changed the /let code to a function, would it go back to operating the way i wanted?

Who knows? (Actually, the question makes no sense whatsoever. Let() is already a function.) 

you should start with what you have (which fields will the calculation use as its input, what are their types, and what do they represent) and then explain what do you want to actually calculate.

 

Edited by comment

  • Author

Apparently, there was alot of field errors. I deleted the variables, and the rounding and it now works perfectly.

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.