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.

Scripting digits to right of decimal

Featured Replies

I've come up with a kludge to handle this by converting to text and fiddling, but there must be a more elegant way to handle it.

I sell books, and depending on what nation they are sold in, the amount may come with two digits to the right of the decimal (like US$), or not (like Japanese yen). It would be convenient to be able to automatically change the format of the prices on invoices and such based on a simple switch for "yen or dollars." Each book has a specific yen price and a specific dollar price set individually.

Any ideas for a simple way to implement it?

You can define a calculated field, and set it to

Round ( Amt1; Digits_to_Round_to)

Be sure to uncheck do not replace existing value; this way, it will update value when digits_to_round_to changes.

To automatically fill based on country, and prefix the amount with appropriate currency symbol, the calculated field might read

Case(Country="Japan";"¥" & Round(Yen_Amt,0);Country="US"; "$" & Round(Dollar_Amt,2);"Amt Unknown because country not recognized")

If there are many countries, the logic could instead use a lookup on a related database for currency symbol and digits.

there must be a more elegant way

There is, but not in version 8.5.

Try something like:


Case ( 

Currency = "US" ;

"$" & Int ( DollarPrice ) & SerialIncrement ( ".00" ; 100 * Mod ( DollarPrice ; 1 ) ) ;

"¥" & YenPrice )

Note that this assumes your prices are already rounded as appropriate for each currency.

  • Author

This does not seem to work when the US$ amount ends with ".00"

  • Author

This appears to work fine... I have to confess I don't completely understand what you just did, but I'll figure it out.

And it is easily adaptable to multiple currencies!

Thank you!

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.