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.

Format Currency in a [text] Result Calculation

Featured Replies

Hello, thanks for your interest.

Looking for assistance in fixing my calculation to properly format currency.

 

This calculation is a note on a report, noting if their line item is discounted or not, only populating if there IS a discount.

 

I've attached images of what I have and of what Im looking for.

Maybe with proper currency formatting of calculation, I can trim the extra lines of adding the "$" .

 

THANK YOU for any help with this one! :)

post-80154-0-47724400-1400180583_thumb.p

post-80154-0-90386900-1400180593_thumb.p

Let's just say that whenever you can, use the layout's formatting option.

 

If this is a just a note on the layout, create a text object with the note text and a merge field ( i.e. the text '(w/ discount $<<subtotal>>)' ) and use 'font size = 500' Conditional Formatting if not discount_rate.

 

As to your calculation (and next time please kindly post the code, not a graphic – we all know how that dialog looks  :laugh: ), you could simplify it as

Case (
  discount_rate ;
  " (w/ discount " & TextStyleAdd ( "$" & subtotal ; bold ) & ")"
)

P.S.: Wouldn't the discount rate itself also be worth mentioning?

  • Author

eos...

 

Noted on the posting code, not just image, rookie. lol

 

I'll most likely do as you suggest, using merge fields and conditional formatting. Guessing this is less load on the system.

Only issue I have with this method, is I can not have discount_note in line with the fee, otherwise if there is a discount, I'll loose the whole line. If I separate, as would be needed for this to work, then I have a structured column and a gap between discount_note and fee to allow for variable amount and the space taken.

 

On the calculation revise you gave me, it does not format the 2 place decimal. For example, $224.20 will populate as $224.2.

 

Regarding the P.S.

I have attached the whole picture on what my estimate looks like. I very much welcome any feedback! :)

 

Thanks for your help eos!

post-80154-0-03445600-1400184648_thumb.p

Not sure I understand the problem: if you create the discount note as merge field and place it as a single, right-justified object before the undiscounted line item - which is a separate field or merge object! – and apply CF, it's either visible or not, but shouldn't impact the display of the other object. 

 

To the PS: you're mentioning that a discount has been applied, but not what it is; I thought this might be worth mentioning, but then again, maybe your clients customer are happy enough to simply receive it …

 

Decimal places: If you have a merge field/object, you can apply the Inspector's formatting options to it, i.e. two decimal places.

 

If in a calculated text block you want to ensure a certain number of decimal places for a currency, you need to program it; there are CFs that care of it, but since you don't have FM Advanced, do it yourself: 

Case (
  discount_rate ;
  Let ( [
    ~s = subtotal ;
    ~i = Int ( ~s ) ;
    ~d = ( ~s - ~i ) * 100 ;
    ~d = SerialIncrement ( "00" ; ~d )
    ] ;
    " (w/ discount " & TextStyleAdd ( "$" & ~i & "." & ~d ; bold ) & ")"
  )
)
  • Author

 

Not sure I understand the problem: if you create the discount note as merge field and place it as a single, right-justified object before the undiscounted line item - which is a separate field or merge object! – and apply CF, it's either visible or not, but shouldn't impact the display of the other object.

 

Only issue... Maybe I'm missing something, or you know a trick to fix this. I know I'm being petty, but I don't like the hard gap between the discount note and the fee

post-80154-0-89073000-1400191350_thumb.p

I know I'm being petty, but I don't like the hard gap between the discount note and the fee

 

Combine both into a single merge object – or create a single calculation field that calculates the entire string. Be creative, that's your job, IIUC …  :laugh:

 

PS: When I said clients might be interested in seeing the actual discount, I meant the rate applied (i.e. '"w/ " & discount_rate & "% discount:" …'), not the amount saved. This design looks a bit too busy to my non-designer's eyes…

  • Author

Thanks for your assistance eos! :)

 

I've settled, for now, with the attached layout.

Just using merge fields, separated from the merge field total's.

Discount notes only appear if there are discounts.

 

 

Not shown in attachment; I changed subtotal discount note to match format of line item discount note.

post-80154-0-45634400-1400262397_thumb.p

Edited by Dr. Evil

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.