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.

Trailing Zero Problem

Featured Replies

  • Newbies

The setup:

I'm in the process of building an invoice system for a computer repair company. On the actual invoices some products are covered under warranty and have a custom code for the total. Some products leave the shop with no charge, which also has a custom code. Everything else has a dollar amount.

I have a Total field which is defined as text so that the custom codes can be entered. The majority of time there will be a number total in $, but sometimes there will be the custom code. Thus the text field definition. The problem I'm having is that I can't seem to get the calculations to keep the trailing zero on amounts like $89.50. I don't want to write a huge case statement, or loop just to keep a zero on the end of an amount. And to this point I've not found a solution which allows me to format this field as a number with set decimal places when a number is in the field.

Any suggestions you might have would be helpful.

I got a bit lost in your explanation, but in any case you can add trailing zeros to a number this way:

Int ( Amount ) & "." & Right ( "00" & Amount * 100 ; 2 )

Note that this assumes Amount is rounded to 2 decimal places.

---

And not negative.

Edited by Guest
Forgot to mention the negative part.

  • Author
  • Newbies

Thanks that is exactly what I needed.

Comment--

I think that the decimal portion of your calc could be simplified to:

Right ( Amount * 100 ; 2 )

since you're moving the decimal point to the right two spaces by the multiplication.

[i acknowledge the left-padding principle for this sort of thing in general; this example wouldn't need it, though.]

David

I'm afraid that wouldn't work when Amount is between 0 and 0.09 (inclusive).

True, it could be 'simplified' by using "0" instead of "00", since one zero is the most you'll ever need to pad. But the extra zero adds no complexity, and I like it better this way because it makes the purpose of the calc stand out.

Perhaps it would be better to use the dedicated function Filemaker provided for this very purpose:

SerialIncrement ( "00" ; 100 * Mod ( Amount ; 1 ) )

Once again, I am proven wrong! And here I thought I was being so smart.

David

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.