Using list values of type 'number' in a formula related to a column of type integer doesn't generate the correct results

Problem 

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

 

Grid configuration 

 

# # 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:

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):

 

`{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):

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