Apply

Using Advanced Expression Piping within your forms you can create mathematical formulas in order to calculate a value. Using the REALTWO expression, results are displayed with two floating points (1.00, 2.50, 3.14, etc.). This article describes this expression further by providing use cases and rules for proper formatting.

The REAL function allows the expression to convert a set of values into a floating point or real value for either a single value or a list of values from a number of given fields. The difference between REAL and REALTWO is that REALTWO returns the value with two decimal places (1.00) whereas REAL converts the value to a single decimal place (1.0).

Additionally, if you are looking to have more than two decimal places within your response, you will need to use PRECISION instead.

**TIP!** REALTWO can be useful when calculating monetary values.

The setup and formatting of the REALTWO expression is imperative in preventing an ** error** message from appearing on your form where the result of your expression would normally appear. The first line of the REALTWO expression should be set up as follows:

{{ REALTWO(variable1+variable2) }} |

- Each expression is always contained within a pair of double "curly" brackets {{ }}
- There should be a space between the first instance of REALTWO and the last bracket
- Variables you are using are case sensitive
- Always close the REALTWO operation with brackets ( )

What's different of REALTWO over some of the other functions is that REALTWO can be used in conjunction with other functions. For example, using the AVG function, if we want to calculate the average of 3 values, should that value return a floating point, REALTWO can be used to ensure the value displays up to 2 decimal points.

REALTWO using addition | {{ REALTWO(q1[0]+q1[1]) }} | Ensures that the sum of q1[0] and q1[1] displays up to a two decimal places. |

REALTWO using subtraction | {{ REALTWO(q2[1]-q1[0]) }} | Ensures that the difference of q2[1] and q1[0] displays up to a two decimal places. |

REALTWO using multiplication | {{ REALTWO(q1[1]*2) }} OR{{ REALTWO(q1[2]*q2[0]) }} | Ensures the product of the multiplied values displays up to two decimal places. |

REALTWO using division | {{ REALTWO(q1[3]/4) }} OR{{ REALTWO(q2[0]/q1[1]) }} | Ensures the quotient of the divided values displays up to two decimal places. |

REALTWO on another function | {{ REALTWO(SUM(q1[:0])) }} OR{{ REALTWO(AVG(q1[0],q1[2],q1[3]) }} | Ensure the result of the expression using another function displays up to two decimal places. |

REALTWO will not round the value to the nearest number, it will simply remove any additional floating points to meet the Rule, therefore 1.659 will be 1.65 and not 1.66.