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.

Featured Replies

How do I create a calculation to evaluate the actual time spent on a project. If I start on 01/12/06 at 12:00 and end on 01/13/06 at 12:00 it should show 24:00 but instead it shows 00:00 because the date is not included in the calculation, just time. Any advice??? Thanks

Hi

try this calc, result Time:

Timestamp ( dateEnd ; timeEnd ) - Timestamp ( dateStart ; timeStart )

  • Author

Thanks, That did it.

To keep the display from breaking (in case you haven't entered something in every field), it might be a good idea to test first before the calculation evaluates. Something like ...

If (

DateStart and DateEnd and TimeStart and TimeEnd ;

Timestamp ( DateEnd; TimeEnd) - Timestamp ( DateStart; TimeStart)

)

UPDATE: One would think that the checkbox 'Do Not Evaluate if all Referenced Fields are Empty' would stop the calculation but it does not. I believe this is because the calc is straight math in FM's eyes.

LaRetta :wink2:

Well, there's a difference between "all referenced fields are empty" and "any of the referenced fields is empty".

That checkbox responds however (normally stopping the calculation evaluation), if only ONE field (of several referenced) is empty. This is why I believe the wording should be changed on it from 'All' to 'Any'. That is ... unless this behavior has changed in vs. 8. I could be wrong ... I frequently am. But it doesn't effect this calculation in vs. 8.02. If ANY or ALL the fields are empty, the calc either displays ? or displays -17576239:30:00. :wink2:

UPDATE: Okay I was wrong. If ALL fields are empty, and it is unchecked, it won't evaluate. But the reverse is NOT true ... I've had calcs NOT evaluate with one blank field with that checkbox checked. Oh never mind, Michael, this checkbox and I have had a long love/hate relationship ... :wink2:

Always test it. That's the answer. Always test it first.

Edited by Guest
Added Update

(normally stopping the calculation evaluation), if only ONE field (of several referenced) is empty.

Can you give an example?

Here is one such (seemingly) inconsistent example. This calculation appropriately does NOT calculate (because the box is checked 'Do not evaluate if ALL referenced fields are empty' and all fields ARE empty).

But if you enter a value in the First Name, it still will REFUSE to evaluate the remaining fields unless I uncheck that box. This is an example of when I feel the wording should be 'if ANY' fields are empty.

This thread also displays some of this inconsistent behavior. The checkbox seems illogical and inconsistent (although it's probably just me). Maybe it is only the wording. Or maybe it should just be reversed. But it is certainly confusing ... :wink2:

UPDATE: In the above example, the checkbox would stop eval if all fields were empty but would do nothing to protect if only one field is empty. And, unless ALL fields are filled it, the calc will break. Maybe we just need another checkbox called "Don't evaluate if ANY fields are empty." That would save us from many IsEmpty() tests. :)^)

LaRetta

DoNotEval.zip

Edited by Guest
Added Update

The only inconsistency I see in that thread is between versions. I am under the impression that from v.7 and up it works as expected.

The file you have attached is interesting - how am I supposed to know if it evaluates or not?

If it evaluates, calculation evaluation results will fill in with field labels. They are reps of the same calc.

And yes, I was just sitting here reviewing that most of the problems with Do Not Evaluate have happened to me in prior versions. :wink2:

Edited by Guest

I've pinpointed my thinking on why it feels so illogical.

With checkbox checked, no labels should show if there is no field data. That works.

With checkbox unchecked, all labels should show no matter what. That also works.

BUT, having the checkbox checked should NOT stop the evaluation if one field has data; in fact, the checkbox shouldn't make a difference if checked. Do you see why it feels inconsistent?

I think what happens here is this: for each repetition, there is only one referenced field. If it is empty, it does not evaluate.

I can work with that logic. Except if I change the FirstName by adding a field MiddleName, then adjusting calc to include TWO fields, it still breaks. Try:

Case(Extend(FirstName) = "" and Extend(MiddleName) = ""; "First Name");

With the checkbox checked, and entering something into ANY field, the calc should still evaluate, I would think? I'm sure I'm missing something here yet ...

Edited by Guest
Fixed miswording...

Case(Extend(FirstName) = "" and Extend(MiddleName) = ""; "First Name");

From the point of view of THIS repetition, FirstName and MiddleName are ALL the fields that there are. This is more about how repeating calc fields behave than how the "Do not evaluate" option behaves. See the atached for another example that shows this.

DoNotEval.fp7.zip

Well now - I LIKE this Michael!

Just by referencing a field which is never empty (even a global or an ID), we can force a calculation to fire on any field referenced which is empty (in this example). Using a Common field with Do Not Eval may be a handy thing. I may be able to eliminate some IsEmpty() and not IsEmpty() tests or control a calc fire via a Common field. I will play with it ...

I will let go of this oddity now but one other comparison? I thought a single rep repetition was just like any other field (and I understand it treats ALL reps as one field and that's why it was breaking). FM should be seeing this just as a standard calc on a standard field. It still breaks with:

Choose(Get(CalculationRepetitionNumber) - 1;

Case(Extend(FirstName) = "" and Extend(LastName) = ""; "Evaluate")

)

Do Not Evaluate checkbox stops the evaluation on a 2-field single calculation. Is this still just because it's a repetition and not a NORMAL field? Thank you so much!! :smile2:

LaRetta

Edited by Guest

Maybe I am missing something here: I don't see any change in behavior when you wrap the calc in Choose(Get(CalculationRepetitionNumber) - 1;...). It's still looking at the fields it has to evaluate, and if all of them are empty, AND the checkbox is on, it does nothing. What you call breaking, I call working very well.

In your original calc, each repetition has a single field to worry about. If that field is empty and the checkbox is on, than that's it. It doesn't care about what the other repetitions have on their plate (and considering that there may be 32,000 of those, that's a good thing!).

When I added a field BEFORE the Choose(), it became part of EVERY repetition's evaluation chain - so if that one wasn't empty, ALL repetitions had to evaluate. I didn't think it was of any practical value (much cheaper just to uncheck the box); I just wanted to show the behavior.

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.