Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I would like some help with the syntax of current expression that I am trying to use in a tXMLMAP expression:
(sort_APB_contr.TOT_BEDRAG_INCL_T_O__.subtract(sort_APB_contr.T_O_BEDRAG)).divide(sort_APB_contr.TOT_AANTAL_INCL_T_O__.subtract(sort_APB_contr.T_O_AANTAL))
I am getting the following error message:
"Exception in component tXMLMap_1
java.lang.ArithmeticException: Division undefined
at java.math.BigDecimal.divide(Unknown Source)"
Basically what I would like to accomplish is the following calculation:
(sort_APB_contr.TOT_BEDRAG_INCL_T_O__ minus sort_APB_contr.T_O_BEDRAG) divided by (sort_APB_contr.TOT_AANTAL_INCL_T_O__ minus sort_APB_contr.T_O_AANTAL)
Thanks!
Kind regards
Dave
sort_APB_contr.TOT_AANTAL_INCL_T_O__.subtract(sort_APB_contr.T_O_AANTAL) != (new BigDecimal(0)) ? (sort_APB_contr.TOT_BEDRAG_INCL_T_O__.subtract(sort_APB_contr.T_O_BEDRAG)).divide(sort_APB_contr.TOT_AANTAL_INCL_T_O__.subtract(sort_APB_contr.T_O_AANTAL)) : 0 (change to the value to be returned)
JoRoesecke wrote:
Hi
This usually means that you are trying to divide by zero. You will need to catch this. Example (not tested):
sort_APB_contr.TOT_AANTAL_INCL_T_O__.subtract(sort_APB_contr.T_O_AANTAL) != (new BigDecimal(0)) ? (sort_APB_contr.TOT_BEDRAG_INCL_T_O__.subtract(sort_APB_contr.T_O_BEDRAG)).divide(sort_APB_contr.TOT_AANTAL_INCL_T_O__.subtract(sort_APB_contr.T_O_AANTAL)) : 0 (change to the value to be returned)
Let us know how this works out for you.
Regards,
Joachim
((sort_APB_contr.TOT_AANTAL_INCL_T_O__.subtract(sort_APB_contr.T_O_AANTAL)).compareTo(new BigDecimal(0)) == 0) ? (sort_APB_contr.TOT_BEDRAG_INCL_T_O__.subtract(sort_APB_contr.T_O_BEDRAG)).divide(sort_APB_contr.TOT_AANTAL_INCL_T_O__.subtract(sort_APB_contr.T_O_AANTAL)) : 0 (change to the value to be returned)
JoRoesecke wrote:
Yes, definitely. Try this:
((sort_APB_contr.TOT_AANTAL_INCL_T_O__.subtract(sort_APB_contr.T_O_AANTAL)).compareTo(new BigDecimal(0)) == 0) ? (sort_APB_contr.TOT_BEDRAG_INCL_T_O__.subtract(sort_APB_contr.T_O_BEDRAG)).divide(sort_APB_contr.TOT_AANTAL_INCL_T_O__.subtract(sort_APB_contr.T_O_AANTAL)) : 0 (change to the value to be returned)