Jump to content

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

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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.

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