- Introduction to WorkXpress
- Building Your Application
- Examples and Best Practices
- Technical Manual

This shows you the differences between two versions of the page.

— |
expression function - round [2016/09/14 14:19] (current) |
||
---|---|---|---|

Line 1: | Line 1: | ||

+ | ====== Round (Expression Function) ====== | ||

+ | ===== Purpose ===== | ||

+ | The **Round** function (ROUND) rounds a number up or down to a certain number of decimal places | ||

+ | |||

+ | {{:round_initial.png?direct&600|}} | ||

+ | |||

+ | ===== Parameters ===== | ||

+ | The **Round** function has two parameters, one of which is required: | ||

+ | |||

+ | ==== Value ==== | ||

+ | |||

+ | Allowed Inputs: [[Field|field]] value or number | ||

+ | |||

+ | The first required parameter is the number that will be rounded. Either use the use the [[Query Builder]] to choose a field that contains the value or use type a value to enter a number. | ||

+ | |||

+ | ==== Precision ==== | ||

+ | |||

+ | Allowed Inputs: [[Field|field]] value or a number | ||

+ | |||

+ | The second optional parameter of the **Round** function is the number of decimal places to round to. If no value is provided then 0 will be used and the value will be rounded up to the nearest integer value. If the number is positive then the rounding will include that number of digits after the decimal. If the number is negative then the number will round with that many zeros on the left of the decimal. | ||

+ | |||

+ | |||

+ | ===== Output ===== | ||

+ | |||

+ | The output of the **Round** function is a number representing the value rounded to the nearest decimal place. | ||

+ | |||

+ | ===== Example ===== | ||

+ | |||

+ | For example ROUND(-5.56) would result in -6 and ROUND(5.56) will result in 6. Using positive precision for example ROUND(5.33,1) would result in 5.3 and using negative precision ROUND(12.33,-1) would result in 10. |

Copyright WorkXpress, 2020