BUG in Field Type plugin

mkainz

Member
When i use separator for unit and decimal
For example 12?
12,00 (using ',' for decimals), i enable the number format and it reports me 12000 on calc plugin ... how to fix this?
 
That's not a bug, that's simply that the number formatting is only applied during rendering of the field, it's not a part of the actual "value". if it was, then simple calc's that do things like addition ...

Code:
return '{foo___field1}' + '{foo___field2}';

... would fail because you can't do math on formatted numbers.

Just redo the number_format() you need in the calc.

Code:
$myNumber = number_format('{yourtable___yourelement}', 2, ',', '.');

... or whatever number format it is you need:

http://php.net/manual/en/function.number-format.php

-- hugh
 
That's not a bug, that's simply that the number formatting is only applied during rendering of the field, it's not a part of the actual "value". if it was, then simple calc's that do things like addition ...

Code:
return '{foo___field1}' + '{foo___field2}';

... would fail because you can't do math on formatted numbers.

Just redo the number_format() you need in the calc.

Code:
$myNumber = number_format('{yourtable___yourelement}', 2, ',', '.');

... or whatever number format it is you need:

http://php.net/manual/en/function.number-format.php

-- hugh
What if i want to do calc on formatted numbers? How can i trasform back to pure values, do calcs and put them back to formatted?
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top