spb Posted October 3, 2002 Posted October 3, 2002 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
falkaholic Posted October 3, 2002 Posted October 3, 2002 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.
slstrother Posted October 4, 2002 Posted October 4, 2002 Try this calc. Replace "Number Field" with the name of your field. NumToText(Int(Number Field))&Left(NumToText(Mod(Number Field,1))+.001,3)
slstrother Posted October 4, 2002 Posted October 4, 2002 Here is another one. Left(NumToText(Number Field+.001),Length(Number Field+.001)-1)
spb Posted October 4, 2002 Author Posted October 4, 2002 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
RussBaker Posted October 6, 2002 Posted October 6, 2002 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.
Recommended Posts
This topic is 8155 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 accountSign in
Already have an account? Sign in here.
Sign In Now