4 Replies Latest reply on Feb 5, 2009 10:12 AM by Figaro2

# Is there a simple way to display a decimal as a fraction in FMP5?

### Summary

Is there a simple way to display a decimal as a fraction in FMP5?

### Description of the issue

I would like to be able to display calculated results in fractional form.

• ###### 1. Re: Is there a simple way to display a decimal as a fraction in FMP5?

Figaro2:

That depends on the fraction.  For example, if the result is 2.70588235, do you want to round it off and display 2-36/51?

You'll need to determine how complicated you want the fraction and how much to evaluate.  Depending on that, it probably can be accomplished.

TSGal

FileMaker, Inc.

• ###### 2. Re: Is there a simple way to display a decimal as a fraction in FMP5?

It doesn't need to be too complex.  I am designing a recipe program. The recipes call for simple fractions in 8ths, 4ths, 3rds, halves or mixed numbers e.g.  1 1/2 Cups.  I am entering the amounts in a text repeating field using fraction notation.  I have defined a multiplier field that will be used to adjust the recipe amounts. Since the result is displayed as a decimal I would like to convert it to a fraction.

• ###### 3. Re: Is there a simple way to display a decimal as a fraction in FMP5?

Figaro2:

Thank you for the clarification.

It looks like you have a limited set of possibilities, so you may want to just use a calculation field.  For example,

Int (Calc) &

Case (Calc - Int (Calc) = 0.5; " 1/2";

Calc - Int (Calc) = 0.25; " 1/4";

Calc - Int (Calc) = 0.75; " 3/4";

Calc - Int (Calc) = 0.125; " 1/8";

Calc - Int (Calc) = 0.375; " 3/8";

Calc - Int (Calc) = 0.625; " 5/8";

Calc - Int (Calc) = 0.875; " 7/8";

Calc - Int (Calc) = 0.333; " 1/3";

Calc - Int (Calc) = 0.666; " 2/3";

"")

Try this out, and see if this works for you.

The only caveat is how you enter 1/3 and 2/3 values.  For this example, I used .333 and .666 respectively.

TSGal

Filemaker, Inc.

• ###### 4. Re: Is there a simple way to display a decimal as a fraction in FMP5?
It worked like a charm.  I had a couple of minor issues. It displayed a 0 when calc was simply a fraction.  I adjusted your statement by creating a conditional statement If (Int(calc)>0,etc,etc).  I also changed .666 to .667. It calculated 2/3 as .667 when I placed it in a Round function. Thanks for your help.