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.

Calcing a price into a text field

Featured Replies

What I need to do is make a text field that takes the result of a calculation in another field and makes it text with trailing zeros. FM numbers insist on dropping these, so I always get "prices" that look like:

12.95

12.5

12

I need them to look like (in my new text field);

12.95

12.50

12.00

so I can export the result to a DOS app that requires this. I tried to set up a three function Case using Position nested inside of Right to hunt for the decimal point as a text string, and depending on where it is found (third character from right, second character, or not there at all) to add 2, 1 or no zero characters to the end of the number. But I got hopelessly lost in calculation syntax.

Anybody know an easy way to do this?

Steve Brown

In layout mode, use the menu 'Format > Number' to bring the format dialog box up.

If you ever need to export those fields, remember to check the option to use formating in the export dialog box.

Try this calc. Replace "Number Field" with the name of your field.

NumToText(Int(Number Field))&Left(NumToText(Mod(Number Field,1))+.001,3)

Here is another one.

Left(NumToText(Number Field+.001),Length(Number Field+.001)-1)

  • Author

I can't export a layout format, as my text price field gets embedded into a large concatenation field, and *this* is the field exported.

But both of those two calcs work beautifully. I chose the second one posted (Left ..., Length ...) because I can follow what is happening here. Very clever and elegant. I don't quite grasp the modular function, so decided to go with something I might need to look at again some day.

Thanks, slstrother.

Steve Brown

There is a number calculation in my Handy Bits file in the samples section which converts numbers to currency formats for use in exported text and for web requirements. If you pull the calc apart, just delete the first line if you don't want the "$" symbol in the result.

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.