Enigma20xx Posted May 25, 2012 Posted May 25, 2012 I'm trying to collect numbers in decimal format into a variable, but I can't make them look in the decimal format I need. Say: 2.150 0.123 4.000 The "look" I need is 3 decimal places and if it's less than 1 the 0 before the point. Now I get: 2.15 .123 4 and I need: 2.150 0.123 4.000 I have tryed substitute, setprecision and there is where my knowledge ends, lol. Any idea? Thank you.
comment Posted May 25, 2012 Posted May 25, 2012 Try = Let ( [ r = Round ( number ; 3 ) ] ; Int ( r ) & SerialIncrement ( ".000" ; 1000 * Mod ( r ; 1 ) ) ) Result must be Text.
Enigma20xx Posted May 25, 2012 Author Posted May 25, 2012 Works perfectly. I was just working with this formula of yours that I saw in another post http://fmforums.com/forum/topic/78003-setting-number-of-significant-figures/page__hl__decimal but I was doing a few things wrong. I'm working with percentages and wasn't multiplying by 100, silly of me. And neither knew what was *10^3 for in that formula. You said result must be Text. Been "result Number" works fine, should I change it to Text? Thanks for all your help my friend.
comment Posted May 25, 2012 Posted May 25, 2012 Filemaker is quite forgiving when it comes to data types, but "4.000" is text - the numerical version is 4.
Enigma20xx Posted May 25, 2012 Author Posted May 25, 2012 Decimals in my country are separated by comma and thousands by point. Upside down than imperial measurements. So I think FM will understand a number separated by comma as a decimal number, but if you say I'm wrong I will change it to Text. Thanks.
comment Posted May 25, 2012 Posted May 25, 2012 I'm afraid you are mixing two separate issues. No matter what your file uses as the decimal separator, a number does not have trailing zeros. IOW, GetAsNumber ( "4.000" ) returns 4. Therefore, if you want your field to store the value "4.000" (or "4,000" in your system), good practice requires using a Text field (or a Calculation field with a Text result). BTW, why can't you use a Number field and format it to display 3 decimals?
Enigma20xx Posted May 26, 2012 Author Posted May 26, 2012 Ok, thanks for telling me about that. I just mentioned it in case it could be relevant. I do use a number field with the 3 decimal format. The thing is that I'm making a script that collects many information and place it into a field as a preview of a final document, so when the variable picks the percentage up takes just the number no its format. Works pretty fine. I have taken the note that if I use your formula into a field, results must be text, because I can't do anything with variables, they are always text. That "preview" I export it to a word processor, any idea why exports only plain text? If I copy the preview field and paste it into the word processor keeps the style text format, but if I export it I only get plain text.
comment Posted May 26, 2012 Posted May 26, 2012 The thing is that I'm making a script that collects many information and place it into a field as a preview of a final document, Why not use a list view for the preview? In fact, what advantages do you find in moving the data to a word processor at all? IMHO, there are very few things that cannot be accomplished within Filemaker, and on those rare occasions the data needs to be exported to something more sophisticated than a word processor. In any case, Filemaker exports from the data level and most export formats support only plain text.
Enigma20xx Posted May 26, 2012 Author Posted May 26, 2012 Why not use a list view for the preview? I have think on that possibility, but it's recurrent information from 5 or 6 different related records and many calculated posibilities. It is a DB where I track many things, one of them are meetings (I have been well adviced for you many times about it). I have the meeting itself, assistants, points, votes (of each point or not).... and I need to move back and forth all the time to collect the info and place it into the right place, at the end I set a field with all varibles to build the document. what advantages do you find in moving the data to a word processor at all? Simple: text alignment. lol. My script is getting really long but by now works. Once I'm sure it works perfectly (I also want to keep all the info together in the preview field) my idea is to make the same scritp but using global variables and build the final printable document into a merge field, so I can use text alignment and print it or save it as pdf but I still have a few problems to solve. - I don't know how long the merge field is going to be, sometimes is 4 pages long, some others 2 or 7, so many times I set it too big and others too short. - I need to number the final document in "page x of xx" format so having more pages than needed shows a wrong global count of pages. ... What is supposed is best, a long script with all the secuence or split different works into shorter scripts and call them from a main one?
comment Posted May 26, 2012 Posted May 26, 2012 what advantages do you find in moving the data to a word processor at all? Simple: text alignment. lol. Wat is wrong with Filemaker's native text alignment? - I don't know how long the merge field is going to be, sometimes is 4 pages long, some others 2 or 7, so many times I set it too big and others too short. Set it as large as it can get, then use sliding: http://www.filemaker.com/11help/html/create_layout.9.62.html#1030089 Keep in mind that a layout cannot be taller than 110 inches, though. - I need to number the final document in "page x of xx" format so having more pages than needed shows a wrong global count of pages. Have your script enter Preview mode, go to last page and set a global field/variable to the current page number.
Recommended Posts
This topic is 4564 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