Skip 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.

Text / Number Function

Featured Replies

Hi, does anyone know if there is a simple function to return a number with a fixed number of decimal places? I'm having trouble working with mail.it in getting a text string together with price numbers properly lined up. $2.10 for example is coming out $2.1. I know how to set the number of decimals from the formatting menu but need to work with a text string. Help appreciated. Cheers, Dave

Use the Merge Field function for the number, and insert that that in your text, and you can format the number as you describe.

Lee

Edited by Guest
wasn't very clear

  • Author

I'm sorry but I don't follow. I can't find a merge field function. I know about merge fields but I don't follow how that could be relevant to working on a variable. If I concatenate a string variable to a number field, the result is text but with the number improperly formatted for my needs. I need to force a decimal point and two decimal places, since $200 won't line up in a list of prices such as $4.99, since there won't even be a decimal place added for an integer. Hope this clarifies. Cheers, Dave.

Your first post led me to believe you wanted to format a number from a number field, in some text. You do this using the Insert >> Merge fields in Layout Mode.

I think what you are now asking is how to format a number field in a calculation. It can't be done. A search of the Forum for Format Number Field for export would turn up many treads on this subject. Basically, FileMaker drops any leading or trailing zeros (after the decimal) in calculations. You might use a Text Field Intead of number, and type in your format.

Maybe if you tell us what you want your result to look like we can give you some options.

Lee

I believe this should work. It doesn't include the thousands separator but I don't think you want that. If you need thousands separator or dollar signs, let me know and I can direct you to some great threads on the subject. Calculation (result is text):

Let ( [

num = Round ( numberField ; 2 ) ;

whole = Int ( num ) ;

cent = Round ( Mod ( num ; whole ) * 100 ; 2 )

] ;

whole & "." & Right ( "00" & cent ; 2 )

)

Note: The data can't have more than 2 decimal places.

UPDATE: I thought I should just include that so I've changed the calc...

LaRetta :wink2:

Edited by Guest
Added update

Oh dang it. My brain hickup back to v6 again. :

I like the calculation that [color:red]comment posted. here

HTH

Lee

Yep, that's the one! Thanks for finding it for us, Lee. :wink2:

Perhaps a simpler calc might suffice in this case.

  • Author

Thanks everyone, particularly LaRetta. I'm still finding my way through the functions and had a similar technique to yours in mind but based on detecting the presence of a period within the text string. I just thought there might be a function already built in to achive this, a bit like the old Basic language instructions for formatting numbers by supplying a template. Anyway, I now use your calc with adjustments to the multiplier, zeros and rounding to achieve what I wanted for 0.1c accounting. Thanks again all. Best, Dave.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

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.