problem with decimals - Forum

Forum Navigation
You need to log in to create posts and topics.

problem with decimals

the problem is that by multiplying the variables the result gives me in whole number and not in decimal.
my code:
when you enter the amount goes to the subroutine
:CANTIDADES
If "[RadioGroup5]" "=" "1"
InputBox "CANTIDAD" "INGRESE QUE CANTIDAD DESEA" "[CANTIDAD1]"
Math "[currentPReCIO]*[CANTIDAD1]" "" "[SUBTOTAL1]"
Else
EndIf
Uploaded files:
  • You need to login to have access to uploads.

DefineVar "[datos.Tabla1.PRECIO]" "Decimal" "2" "Global" "[datos.Tabla1.PRECIO]"
DefineVar "[currentPReCIO]" "Decimal" "2" "Global" "[currentPReCIO]"

DefineVar "[SUBTOTAL1]" "Decimal" "2" "Global" "[SUBTOTAL1]"

DefineVar "[totalsumapresu]" "Decimal" "2" "Global" "[totalsumapresu]"

All variables are defined as decimal but set as an integer

Subo Imagen de ayuda

Uploaded files:
  • You need to login to have access to uploads.

@neobook

the problem is that by multiplying the variables the result gives me in whole number and not in decimal.

From the Help file for the Math command ...

decimal places

The number of decimal places to include in the result. Use 0 (zero) to round the result to the nearest whole number or -1 to have NeoBook automatically determine the optimal number of decimal places

So, try and specify 2 for the decimal places parameter like this ...

Math "[currentPReCIO]*[CANTIDAD1]" "2" "[SUBTOTAL1]"

 

DaviddeArgentina and neobook have reacted to this post.
DaviddeArgentinaneobook