7 Replies Latest reply on Nov 18, 2013 8:40 AM by ultranix

# Conditional rounding

### Title

Conditional rounding

### Post

Hey,

I have conditional rounding question, that i cannot solve by myself.

Base calculation field formula looks like this:

Case (price_now  ≥  150; //ROUND TO 5, i.e. 155, 160, 165//;
Case (price_now  ≥  50; //ROUND TO 2,5, i.e. 52.5, 55, 57,5//;
Case (price_now > 10; //ROUND TO 1 i.e. 11, 12, 13//;
Case (price_now > 0; //ROUND TO 0,5, i.e. 1, 1,5, 2, 2,5//;))))

How could i round to the mentioned measurements?

• ###### 1. Re: Conditional rounding
Case ( price_now ≥  150; Round ( price_now / 5 ; 0 ) * 5 ;
Case ( price_now ≥  50; Round ( price_now / 2.5 ; 0 ) * 2.5 ;
Case ( price_now > 10; Round ( price_now / 1 ; 0 ) * 1 ;
Case ( price_now > 0; Round ( price_now / .5 ; 0 ) * .5  ))))

// Round ( YOURNUMBER / MULTIPLE ; 0 ) * MULTIPLE
• ###### 2. Re: Conditional rounding

Thanks, it works perfectly.

Another rounding question. I want to use some numbers in merge field (together with dates and text, and therefore i'm not able to format it all correctly), and i want for numbers that have no decimals to still display ,00, i.e. 14,00, 1.000,00 etc.

How do i achieve it?

• ###### 3. Re: Conditional rounding

If all the number type merge fields in the same text object need the same data formatting, you can use data formatting from the Inspector to set a data format form them just like you would for a normal field object.

You'll need to apply calculation based formatting only if the formats differ between different number merge fields that are part of the same text object.

• ###### 4. Re: Conditional rounding

actually, "merge" field is based on calculation field, that is formatted as text, but includes date, number and text.

• ###### 5. Re: Conditional rounding

And do you really need a calculation field that combines the data like that? What problem does it solve for you?

• ###### 6. Re: Conditional rounding

This might help on formatting numbers → http://help.filemaker.com/app/answers/detail/a_id/5220

• ###### 7. Re: Conditional rounding

Some minor design issues and removes highlighting of boundaries of fields when clicked and dragged on non-button area.