[rules-users] Re-sending : Unexpected MVEL plus operator behavior (string-to-double), in consequence block
Kinshuk Adhikary
kinshuk_in at yahoo.com
Sun Dec 20 21:47:40 EST 2009
Using
drools 5.1
mvel 2-2.0.14
In consequence (then) block : (dialect strict or not does not make a difference)
Trying to sum up some numbers after a multiplication operation. For example :
t.out = t.in2*t.in3 + t.in3*t.in4 + t.in2*t.in4;
(the object t has all its attributes of the type String), all the t.in parameters are actually numbers-as-strings.
So the multiplication is going on fine, as expected, but the addition (+) sign, is concatenating instead of adding.
So the for inputs "1", "2" and "3", the result looks something like : 2.06.03.0 (i.e concetenated) instead of the expected 11.0.
What is going worng How does the + operator decide to do concat instead of doing addition.
Any documentation on this + operator logic ?
Note : The above works fine when I use MVEL without Drools.
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091220/7a948ec3/attachment.html
More information about the rules-users
mailing list