Jump to content

This topic is 8269 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi,

I'm trying to format a number into a currency within a text calculation field.

For example,

"Government Fee : " & GovProcessingFee

would result to "Government Fee : 75"

I wish to obtain "Government Fee : $75.00"

Isn't there an easy way to do this ?

I COULD do the whole calculation using a case, patterncount and position but it seems there SHOULD be an easier way to do this...

Thanks

Posted

You could combine the fields on a layout using a text merge of two fields instead of creating a calculation field. If you select the text in layout mode, you can assign a number format to it. The only done side is if you have two merged number fields in the text, you only get to select one number format per text object.

In Layout Mode:

"Government Fee : <<GovProcessingFee>>"

(place this on the layout without the quotes, of course)

-bd

Posted

That would work but the thing is this is all part of a bigger calculation which tests if some fields are empty before displaying them. So I achieved what I was wanting to do like this for fields that have a value for sure :

"Government Fees : " &

"$" & Case(

PatternCount( NumToText(Round( GovProcessingFee, 2)), ".") = 0,

NumToText(Round( GovProcessingFee, 2)) & ".00",

PatternCount( Right( NumToText( Round( GovProcessingFee, 2)), 2), ".") = 1,

NumToText(Round( GovProcessingFee, 2)) & "0" ,

NumToText(Round( GovProcessingFee, 2)))

I just think that there should be a FormatNumToText function or something. It would make my long calculation much easier to read and debug.

Thanks for your help.

If anyone figures out a better way to do this, please let me know.

Posted

See my answer to dschaal's post in this same forum area on "Calculation needed to format $ amount". My answer will give you $, commas and handle +/- numbers up to 12 digits (so that shouldn't be a limit unless you own Microsoft). My answer also contained another novel way of achieveing this using the "Copy Record" script command.

Either way, you end up with a text field which contains the text expression of your amount, then just concatenate this into your final result.

This topic is 8269 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.