# Page History

## Key

• This line was removed.
• Formatting was changed.

## Problem

When the list value used in a formula is of type number, integers cannot be used anymore.

## Grid configuration

Code Block
```#
# Setup of a grid with a dropdown list containing products
# And a calculation of the VAT.
#

gd.columns=iproduct, price, tvanumber, tvanumberincluded, tvaint, tvaintincluded
gd.tablename=numberz
gd.ds=igridtest

#
# Generate the list, iprice is a decimal number type
#

col.iproduct = Product
col.iproduct.type = list
col.iproduct.query = select iname, icode, iprice from products_d2
col.iproduct.query.ds = igridtest

#
# Show the price in its own column
#

col.price = Unit price
col.price.type = number
col.price.formula = {iproduct.iprice}

#
# The calculation of the price including VAT is correct when
# the VAT column is a number
#

col.tvanumber= Tva
col.tvanumber.type = number

col.tvanumberincluded= TVA included
col.tvanumberincluded.formula = {iproduct.iprice} * (1 + {tvanumber}/100)

#
# The calculation of the price including VAT is not correct when
# the VAT column is an integer
#

col.tvaint= Tva
col.tvaint.type = integer
col.tvaintincluded= TVA included
col.tvaintincluded.formula = {iproduct.iprice} * (1 + {tvaint}/100)

```

## Reason

In the configuration:

Code Block
```col.tvanumberincluded.formula = {iproduct.iprice} * (1 + {tvanumber}/100)
col.tvaintincluded.formula = {iproduct.iprice} * (1 + {tvaint}/100)
```

tvaint column is of integer type, and thus we pass it to JEXL as an Integer Object, and when tvaint is divided by 100, the result is coerced back to Integer (by JEXL):

Code Block
``{iproduct.iprice} * (1 + {tvaint}/100)`: `100 * {1 + ((Integer)10/100)}` <=> `100 * {1 + ((Integer)1/10)}` => `100 * {1 + 0}``

while tvanumber is of number type, and thus we pass it to JEXL as a BigDecimal, and when tvanumber is divided by 100, the result is coerced back to BigDecimal (by JEXL):

Code Block
``{iproduct.iprice} * (1 + {tvanumber}/100)`:`100 * {1 + ((BigDecimal)10/100)}` => `100 * {1 + 0.1}``

` `
` `