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

I have a calculation where the result is 1.5.

I need the value in my field to only be .5.

How do I truncate or format the field so it only recognized the decimal point value.

Try:

aNumber- Int ( aNumber )

--sd

Or Mod ( numField ; 1 )

BTW, I began thinking further ... Mod ( numField ; 1 ) will not work for minus numbers. I believe it will work if there aren't any but I wanted it to be considered in your decision.

If number can be negative, you could use either:

Mod ( Abs ( number ) ; 1 )

or:

Mod ( number ; Sign ( number ) )

depending on whether you want the result to inherit the sign of the input or not.

Ah. Sign(). I like that the best because it doesn't suppose ... it simply truncates and leaves the value as before (but only the remaining) portion. I also wanted to ask if it should be rounded but I assumed that was overkill ... :king:

UPDATE: Yes! This is best because it works both ways!

Edited by Guest

There's one pitfall with the 'Mod ( number, Sign ( number ) )' method:

Sign can return 0, which, if it does, Mod would be attempting to divide by 0, which is undefined. Of course this is a special case; however, this is precisely what we must always be worried about, i.e. the special cases!

Well, excuse me. I just tried using the Mod & Sign calculation and it correctly calculated the value that scottvaughan wanted, e.g.:B

number = 27.385 ==> calc. = .385

number = -17.129 ==> calc. = -.129

number = 0 ==> calc. = 0

That concerns me because FileMaker is making a non-standard choice for a mathematical function. If one created a calculation that resulted in dividing by zero, most software would display some special value like, "#undefined#" or the software would crash. Why would we want FileMaker to do something different?

Sheeesh. I just did some more testing and FileMaker gives a completely incorrect answer when mixing positive and negative:

Mod ( -17.129, 1) ==> .871

Sounds like a bug to me.

It's not a bug at all, but an intentional (and entirely commendable, IMHO) choice:

http://filemaker.custhelp.com/cgi-bin/filemaker.cfg/php/enduser/std_adp.php?p_faqid=721

Too bad the description of the function in the help remains outdated:

http://fmforums.com/forum/showpost.php?post/292075/

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.