January 2, 200521 yr I have a sales database where users enter the advert size as a fraction. The entry could be, for example: 1/2 or 1/16 or 1. To convert the fraction to a number the most efficient calculation I can think of is: If( PatternCount ( SizeFraction ; "/" ) > 0 ; LeftWords(Substitute ( SizeFraction ; "/" ; " " ); 1) / RightWords(Substitute ( SizeFraction ; "/" ; " " ); 1) ; SizeFraction) Is this the most efficient method, or does anyone know of a simpler calculation? Note: 1/2 is 1 word (in Filemaker 5 it was 2 words). Fractions and decimal entries can be entered in the SizeFraction field (eg: 0.5 or 1/2 will produce the result 0.5) Thanks - Peter
January 2, 200521 yr Your calculation tests fine, but maybe -Queue- can come up with something shorter.
January 9, 200521 yr Am I correct in that the Evaluate function is new in FM7? I'm using FM6 and can't find it. Also is there a straight forward way to display a decimal as a fraction, ie 1.625 as 1 5/8? I'm converting fractions to decimals and decimals to fractions but the code involved is tedious at best. I originally had my work set up in Excel and it handles fractions and decimals in the same field without a hitch. I've converted the file over to FM so I can do MUCH more with the info EXCEPT the decimal/fraction issue. TIA for any feedback. Ed
January 9, 200521 yr Did another archive search and found Shadow's response using the Choose function to display proper fractions - I'll give that a try. My question re the Evaluate function still stands. Thanks, Ed
January 9, 200521 yr Another method would be to make a table of decimal & fraction equivalants. Use a lookup to get the conversion. With a lookup you can choose to go to the next higher or next lower value if there is not an exact match.
Create an account or sign in to comment