Multiplication of decimals

Screenshot 2024-01-18 090512

Screenshot 2024-01-18 090610

I don’t know why but after performing a calculation I do not get the right decimal place.
For example; 20 x 5 gives me 10000 instead of 100.00.

Hi Brenden,

Currently, the application model and datatore do not know about decimals at all. It is the webclient doing that (a hint is that it is an @annotation - meant for the client). Which means you are basically doing a multiplication of 2000 * 500 = 1000000 and then the client shows that, interpreting the last two digits as decimals, so: 10000.

So in this case you need a new unit that has 4 decimals, which will be the type of the multiplication result.

Does that help?

Yeah, it worked. Very much understood. Thanks.
But one problem, in this solution we’ll have four digits after the decimal point. I am working with money can the digits be two after the decimal point.
I tried setting the final answer (with the 4 decimals) to a new unit and give it 2 decimals but that didn’t seem to work.

Hi Brenden,

That should work, but you need the following conversion:

‘cents’
= ‘hundreds of cents’ * 1 * 10 ^ -2

Then you can write the following in the model:

‘target’ : number ‘cents’ = from ‘hundreds of cents’ [calculation with 4 decimals result]