Page 1 of 1

Switch.Calculcation

Posted: Mon Oct 09, 2017 7:10 pm
by diguimfodera
Please, I need to know how to make round up math calculations.
I need divide number for 4 and I need Integer number for result, round up it if necessary.
Example: 30/4 = 7,5 (but for number of copies It must be = 8)

Re: Switch.Calculcation

Posted: Mon Oct 09, 2017 8:27 pm
by gabrielp

Re: Switch.Calculcation

Posted: Tue Oct 10, 2017 12:29 pm
by sander
Math.ceil will do;

Code: Select all

quantity = Math.ceil((origQuantity+extra)/nUp);

Re: Switch.Calculcation

Posted: Tue Oct 10, 2017 7:01 pm
by essexmate
I my case I had to divide number of pages by 2, but also needed the number to be rounded up if the number of pages was odd. I used the following:

Code: Select all

[Switch.Calculation:Expression="round([Stats.NumberOfPages]/2)"]