Money in business data model

1
0
-1

Hi,

I'm using the community version of Bonita to capture our internal expenses process.

Obviously, a key part of this is capturing monetary amounts. Can anyone advise on how I can build these into the data model with correct precision.

Currently, I can only select float or double (which obviously have the potential for inaccurate storage) or integer which would mean i'd have to store in cents rather than dollars (e.g. 100.00 = 10000) with associated transforms for displaying etc.

Any advice very welcome. We are looking at upgrading to the subscription edition if these initial processes are a success so i'd also be interested to know if that has any solution to this problem that the community edition doesn't have.

Comments

Submitted by antoine.mottier on Mon, 07/10/2017 - 13:22

Thanks a lot for this feedback. I actually open internally an improvement request to add support of Java BigDecimal to BDM. BigDecimal is mapped to NUMERIC/DECIMAL SQL data type in database and so should be appropriate for currency storage.

Submitted by j.peck on Mon, 07/10/2017 - 14:13

Many thanks Anotine that sounds great. It was good to see the new Java8 date datatypes are now available, I think adding BigDecimal support would be a great further addition.

2 answers

1
0
-1
This one is the BEST answer!

I'm not quite sure why you felt the need to take the tone you did you in your answer. I am well aware of the problems with handling currency in Java, hence my reluctance to use a floating point option.

What I am not aware of is the Bonita best practice/capabilities as I am new to the system and I simply hoped to lean on the communities’ knowledge to help identify the best “Bonita way” to handle this.

The fact that after a lot of talking down to me you parroted back an answer that I had in fact suggested in my question makes me even more confused as to why you felt the need to take such an aggressive and condescending tone.

And yes, I’ve worked out in the Middle East too. Also in Japan, where as I’m sure you know there are no decimal places in the currency.

Thanks for the welcome, i'll be sure to stay around.

1
-2
-1

The fact that you're looking at community or subscription really will not help. They have absolutely nothing to do with this at all.

And from a +1 I've marked it down to a zero. Because you've misinterpreted the problem and also not done the the simplest and easiest thing to do, a GooglWebSearch on JAVA datatypes. Had you have done this you would have found there is no primative Decimal type that can be used for monetary values. See the official documentation here (and other bits):
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

https://www.tutorialspoint.com/java/java_variable_types.htm

and other commentaries here:
https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-...

The solution is to use BigDecimal as indicated here:
https://stackoverflow.com/questions/3168580/how-to-save-decimal-in-java

http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html

however that doesn't really help as Bonitasoft (and other systems by the way) do not allow BigDecimal to be used in the BDM itself.

We use INT and divide by 10, or 100 depending on need (use locale to get the realy currency format). Yes I've had to develop a system that uses 3 decimals in their currency.

This is extremely common practice.

You could add an idea to the IDEAS forum and Bonitasoft might then add BigDecimal to the supported datatypes...or at least they may answer as to why it's not done.

regards
Seán

PS: While you may not like the answer, it gives a possible solution, please mark as resolved.

Notifications