Jump to content

Adding a decimal to a number


Navigating

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

Recommended Posts

Hi All,

Quick question...how do I format or calculate a number field to add a $ symbol plus a decimal to the number?

Example: number entered into the field 12345, when I tab out of the field I would like the number to show $123.45

Thanks in advance, Sheryl smile.gif

Update:

I found RussBaker's Handy Bits file and was able to get the $ and decimal to display, but the number that displayed was $12,345.00. Does anyone know how to get the number to display without the zeros? Just display the actual number $123.45

thanks again, sheryl

Link to comment
Share on other sites

Hi Thanks for responding,

below is the last line of the calculation he wrote. I'm am not versed in writting calculations or scripts(haven't learned the language)and don't understand any of it. But...I believe this last line contains the information you were referring to above. I have tried rewriting this line by changing the "Right" to "Left", removing the "00"&, changing the 100* to 10*, to 1* and still I can't get my number to show $123.45.

"." & Right("00"&Round((100*(Abs(Total Sales Receipt) - Int(Abs(Total Sales Receipt)))),0),2)

The reason I am trying to perform this task is to cut down on data entry error. If the number 12345 can automatically translate to $123.45, I would greatly appreciate it. This seems like it should be such an easy formatting function, but obviously it's not.

PS. Is there a book out there that I could pickup to learn how to write and speak this scripting/calculation language? I'm sure there must be some kind of FM Scripting for Dummies?

Link to comment
Share on other sites

Assuming you want a number and not a text result.

Case (PaternCount (Total Sales Receipt, ".") = 0, Total Sales Receipt / 100, Total Sales Receipt)

Format the number field in the layout mode to be decimal, fixed 2 places and show $.

The calculation fragment you are showing looks like it is part of a text calculation.

This will be a new field.

Link to comment
Share on other sites

You, my friend are the BOMB!!!!!!!!!! grin.gif

Below is the calculation used to achieve the following result:

number entered into "Total Sales Receipt" = 12345

number displayed in "Total Sales Receipt Calc" = $123.45

Case(Total Sales Receipt<0,"-$","$") &

Case(PatternCount(Total Sales Receipt, ".") = 0, Total Sales Receipt / 100, Total Sales Receipt)

May the sun shine brightly on the rest of your days!

Thank you, Sheryl

Link to comment
Share on other sites

This topic is 6987 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.