TextField.setDatatype(Datatypes.get(BigDecimal.class));

I was wondering, If I put this line in the code

amountField.setDatatype(Datatypes.get(BigDecimal.class));

I discovered that the value returned from getValue was negative.
if I skipped:

amountField.setDatatype(Datatypes.get(BigDecimal.class));

The value from TextField.getValue() was positive.

How does this work?

Hi Kjell,

We cannot reproduce the issue. Could you create a test project?

I figured out where the problem was.
The desimal formatting caused the problem.
Blank space *
#*##0. 00 did put a negative prefix in front.

What I trying to do is to put a space as thousand grouping separator instead of a comma.
I have tried with #\u0020##0. 00
That didn’t work.

I have solved the issue with creating new Datatype with preferred formatting based on the original Datatype for BigDecimal found in the core.

Please note that there are special format strings for decimal and grouping separators, see Datatype Format Strings - CUBA Platform. Developer’s Manual