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.

Newbie Calculation Question

Featured Replies

  • Newbies

I have a problem trying to use a number that needs to be formatted as currency in a new calculated text field.

The new field I'm creating will be a Text field containing the values of the Account, Date, Amount, Memo.

The Amount is in a field which is defined as a number (i.e. 1000 or 10.64). In the new calculated field, I need to add the currency sign, the commas and the decimal points.

I can't figure out how to do that. Whan I create my calculation in the new field, it formats the field just as it is stored. My calc is: Donor & "|" & Date & " - " & Amt & " - " & Memo.

Any help would be appricaited.

Thanks - kevin

Maybe something like this:

Donor & "|" & GetAsText ( Date) & " - " & "$ " & GetAsText ( Amt ) & " - " & Memo

which would return

Jim|12/12/2005 - $ 12.40 - this and that

HTH

Lee

Edited by Guest
showed result

Try:

"$" &

Case ( Div ( Amt ; 1000 ) ; Div ( Amt ; 1000 ) & "," )

&

Right ( Int ( Amt ) ; 3 )

& "." &

Right ( "00" & Amt * 100 ; 2 )

This assumes that Amt is a positive number, rounded to the nearest cent, and smaller than million.

Ah shoot. I didn't test for more than 1000.

So, if the thousand separator is important, then the amended calculation would be:

Donor & "|" & GetAsText ( Date) & " - " & "$ " &

Case ( Div ( Amt ; 1000 ) ; Div ( Amt ; 1000 ) & "," )

&

Right ( Int ( Amt ) ; 3 )

& "." &

Right ( "00" & Amt * 100 ; 2 )

& " - " & Memo

I was excited to see when FileMaker changed the TextToNumber (v6) to GetasText(Number) in (v7), that they also changed it so that the decimals show (provided they were entered in the number field). Too bad the thousand separators don't carry over and we can stop having to use a workaround case statement.

oh well, maybe in version 9 or 10.

Lee

the decimals show (provided they were entered in the number field)

I find this a very confusing "feature". I would expect a NUMBER to ignore any redundant digits that the user have chosen to input. You certainly cannot rely on it, because it doesn't work when the number comes from a calculation.

I didn't say it was perfect. In fact I even modified the calculation to include your Case statement because I didn't like the same things.

Lee

Maybe - just maybe - a calc isn't even needed. If this is for display, merge fields would work a treat for you (and save adding another field to your field definitions, as well as saving a bit of resource).

If you use merge fields, each piece can be formatted as its specific type, ie, the date could be written out or the number could be selected and formatted as dollars etc. It's surprising how many times I've created a calculation when it's sole purpose was to display. :wink2:

  • Author
  • Newbies

Thanks for your advice. Tomorrow when I am back in the office, I will give it another shot implementing your suggestions.

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.