Jump to content
Sign in to follow this  
Heres Trouble

Decimals only when required

Recommended Posts

Hi All,

I have an ingredient quantity field in my recipe database in which I typed numbers as I wanted to see them, ie all quantities less than 1 were prefixed by "0.", and non-whole quantities above "0" used either 1 or 2 decimal places, for instance "0.25", 0.33, 0.5, 0.75 - this is the easiest on the eye for my application. However, because I've now made the field a calculation field (so I can expand or reduce the number of serves), Filemaker wants to give me 2 decimal places everywhere. Does anyone know how to fix this? Thanks in advance for any help! Helen

Share this post


Link to post
Share on other sites

Your ingredient quantity shouldn't be a calc field. You need another calc field, TotalQty = Serves * Ingredient Qty. Right?

Anyway, either use the Round() function to avoid decimal places or use Format>Number in layout mode to only show n decimal places.

Share this post


Link to post
Share on other sites

Hi Bcooney and thanks, but you seem to have misunderstood what I require. I might have a recipe that serves four people that I typed as

2 cups flour

1.5 cups basil.

When I decide to cook for two people, I want the quantity field (calculation NumberofServesNew / NumberofServes * IQuantity) to show decimal places only when not zero, and always show leading zero when less than one.

1 cup flour

0.75 cup basil

Share this post


Link to post
Share on other sites

Format the field as decimal. Deselect the 'Fixed number of decimal digits' option.

Share this post


Link to post
Share on other sites

I have a related problem with a calculation that I am using, but instead of always showing a zero, I want to never show the zero left of the decimal. i.e. I have an average that I want to appear as .420 and not 0.420.

Any suggestions?

Thanks

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.