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.

calculating values within a field?

Featured Replies

  • Newbies

Hello everyone

Here's the challenge, I need to be able to add numbers together within a field i.e. "27" = 9 or "11.2 11.7" = 4.9 basically reducing the value to it's simplest number. I'm not that well versed in math calculations or formula's but there must be a way to do this in FM?! FYI, This will be used in a Lab for determining patient results, but there will be many values (that need this calc done on them or the whole thing is a bust) within a table.

Thank you

Arthur

If you don't mind typing in operators, e.g.

"2+7" and "11.2+11.7", then you should explore how the Evaluate[] function works. Look in FileMaker Help.

If operators need to be implied, then you'll want a Substitute[] function as well, e.g.

Evaluate(

Substitute(myfield;" ";"+")

)

The first is obviously more flexible since the user can type in any mathematical formula.

Well, 2+7 returns 9, but 11.2+11.7 returns 22.9, not 4.9 as indicated. I don't know what "reducing the value to it's simplest number" means. Perhaps it's just summing all the digits, unless there's a decimal point - that's the only way I can see of getting 4.9 from "11.2 11.7". But I cannot imagine how this would be useful in any context, and I am concerned for the well-being of the patients using this lab.

He must mean summing the values 1, 1.2, 1, 1.7 and summing the values 2, 7.

Must?

Well, it does add up that way. I have to say the logic is a little obscure. How the heck do you differentiate between "11.2" as a number versus "11.2" representing a statement to evaluate (1 + 1.2)? Only the poster knows.

Actually, Michael knows too. Sorry, just read your post a little more closely.

Still don't understand why.

Maybe because the OP isn't paying that much attention to the spacebar when posting? Who knows? And does it really matter? Either your first comprehensive answer will suffice or he'll clarify the logic.

Maybe because the OP isn't paying that much attention to the spacebar when posting? Who knows? And does it really matter? Either your first comprehensive answer will suffice or he'll clarify the logic.

It doesn't matter at all. I just worry and nibble at things long after they cease to be important. It's a personal failing.

Hi Arthur,

i.e. "27" = 9 or "11.2 11.7" = 4.9

Can you give more information about this? I assumed the first one is "2+7=9" and the second one may come from "1+1+1+1 . 2+7 = 4.9"? Is that right? :qwery:

  • Author
  • Newbies

Hello Henry

Yes to the way you added things up. the numbers represent seconds (time value) they are response times of the patients. However inorder to use them they must be reduced. another example. 64 6+4would equal 10. just as 2008 would 2+0+0+8=10. these time results are then used with other variables at the end to make sense of the data collected. I am very appreciative for all the responses WOW. if this is not clear enough I will attempt another example. Most of the other variables are simple addition, division or averaging. between other sets of numbers. The weird thing here is doing it within the field (1111) or a set of field (111) + (222)+(333)= 18. thanx again

Arthur

Let me make a suggestion: get whoever inputs the data to input it correctly. It seems that in this case correctly means a new record for each entry. That's where the real problem is, IMHO.

He must mean summing the values 1, 1.2, 1, 1.7 and summing the values 2, 7.

... or redux first number & "." & redux second number like:

11.2 -> 4

11.7 -> 9

so 4.9

... or redux Int ( first number ) + redux Int ( second number ) like:

11.2 -> 2.2

11.7 -> 2.7

so 2.2 + 2.7 = 4.9

This calculation seems to solve all your examples:

Case(

Mod ( field ; 9 ) > 1 ; Mod ( field ; 9 );

Mod ( field ; 9 ) + 9

)

So there will never be a single number greater than 9? I agree with Comment ... this is very funky way of handling it. And what if the User puts a[color:green]n extra space or some other character?

Update: Added the green for clarity

Edited by Guest

Wow, not only that but the logic is totally whacky.

11.2 11.7" = 4.9

And what if it is 11.99 11.9? It should equal 4.108? Does it ever round? Is it a decimal or some meaningless second number?

Danielle, your last calculation seems to produce strange results on the example 11.2 11.2. I get 2.2112.

None of this makes any sense to me at all. Sorry. :crazy2:

Edited by Guest
Fixed typo in calc example

the numbers represent seconds (time value) they are response times of the patients. However inorder to use them they must be reduced.

Why must they be reduced to this shorthand notation? Is this some kind of standardized shorthand notation used in your industry? Or is it some clever idea someone came up with in your department?

If it's standardized, can you point us to the standard? I'm curious, and looking at the actual standards document would probably clarify.

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.