It is known that processing slows when using nested IIF statements. In order to simplify the expressions functions for Roundup and Increments for Ceiling.Math with are needed.
Roundup function with a precision
Roundup(100.03,1) = 100.1
math function like excel
MATH(16.25,15,0) = 30
IIf(this.RoundingPrecision=1,System.String.Format("{0:0.0}",System.Math.Ceiling(this.CompQuantity*10) / 10)
I would want to round the length of a line to an interval of 15. In excel it would be =CEILING.MATH(A2,15,0) A line length of:
99 = 15
4 = 15
25 = 30
18 = 30
8 = 45
44 = 45
Generic example for interval of 15: iif(x mod 15 = 0, x, (x \ 15 +1)*15)
More specific example of increment:
System.Math.Round(System.Math.Ceiling(this.CompQuantity),this.RoundingPrecision), (this.CompQuantity \this.RoundingIncrement +1)*this.RoundingIncrement))
IIf((this.RoundingConservative=True) && (this.RoundingIncrement=0),(IIf(this.RoundingPrecision=0,System.String.Format("{0:0}",System.Math.Ceiling(this.CompQuantity)),(IIf(this.RoundingPrecision=1,System.String.Format("{0:0.0}",System.Math.Ceiling(this.CompQuantity*10) / 10),(IIf(this.RoundingPrecision=2,System.String.Format("{0:0.00}",System.Math.Ceiling(this.CompQuantity*100) / 100),(IIf(this.RoundingPrecision=3,System.String.Format("{0:0.000}",System.Math.Ceiling(this.CompQuantity*1000) / 1000),(IIf(this.RoundingPrecision>=4,System.String.Format("{0:0.0000}",System.Math.Ceiling(this.CompQuantity*10000) / 10000),-1)))))))))),IIf((this.RoundingConservative=False) && (this.RoundingIncrement=0),System.Math.Round(this.CompQuantity,this.RoundingPrecision),IIf((this.RoundingIncrement=0) || (this.CompQuantity mod this.RoundingIncrement = 0), System.Math.Round(System.Math.Ceiling(this.CompQuantity),this.RoundingPrecision), (this.CompQuantity \this.RoundingIncrement +1)*this.RoundingIncrement)))