Money in business data model
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.
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.
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):
and other commentaries here:
The solution is to use BigDecimal as indicated here:
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.
PS: While you may not like the answer, it gives a possible solution, please mark as resolved.