October 3, 200223 yr What I need to do is make a text field that takes the result of a calculation in another field and makes it text with trailing zeros. FM numbers insist on dropping these, so I always get "prices" that look like: 12.95 12.5 12 I need them to look like (in my new text field); 12.95 12.50 12.00 so I can export the result to a DOS app that requires this. I tried to set up a three function Case using Position nested inside of Right to hunt for the decimal point as a text string, and depending on where it is found (third character from right, second character, or not there at all) to add 2, 1 or no zero characters to the end of the number. But I got hopelessly lost in calculation syntax. Anybody know an easy way to do this? Steve Brown
October 3, 200223 yr In layout mode, use the menu 'Format > Number' to bring the format dialog box up. If you ever need to export those fields, remember to check the option to use formating in the export dialog box.
October 4, 200223 yr Try this calc. Replace "Number Field" with the name of your field. NumToText(Int(Number Field))&Left(NumToText(Mod(Number Field,1))+.001,3)
October 4, 200223 yr Here is another one. Left(NumToText(Number Field+.001),Length(Number Field+.001)-1)
October 4, 200223 yr Author I can't export a layout format, as my text price field gets embedded into a large concatenation field, and *this* is the field exported. But both of those two calcs work beautifully. I chose the second one posted (Left ..., Length ...) because I can follow what is happening here. Very clever and elegant. I don't quite grasp the modular function, so decided to go with something I might need to look at again some day. Thanks, slstrother. Steve Brown
October 6, 200223 yr There is a number calculation in my Handy Bits file in the samples section which converts numbers to currency formats for use in exported text and for web requirements. If you pull the calc apart, just delete the first line if you don't want the "$" symbol in the result.
Create an account or sign in to comment