2012-04-03 06:25 AM
I need to do some calculations in a Workflow and the result is not as expected. For troubleshooting purposes I created Workflow return paramaters that do the same calculation. The return parameters print all variables that I use for the calculation, the actual calculation as well as the same calculation with fixed values instead of variables. From the return parameters I can see that all variables have the expected value, however the calculation return an incorrect value (while the same calculation with fixed values give the correct result). Does anybody have an idea what's going on?
This is the definition of the return parameters:
And these are the return parameters after preview:
Solved! SEE THE SOLUTION
2012-04-03 06:42 AM
It looks like it is treating your value from size_mb as a STRING and not INT. I had an issue like that before and fixed it by declaring the value as an (int) (parameter) + value. This worked very well prior to upgrade to 1.1 but afterwards I found that I didn't have to do that for the specific reason I was implementing it. What does your Define or Function look like?
2012-04-03 06:52 AM
Indeed interesting on MVEL side.
If you look closely (And you probably did) you can see that the result is a string concatenation of the size_mb with the result of the subtraction action.
MVEL somehow decides to concatenate the size_mb with the subtraction result and that's what you see as a result.
Why does it subtracts in the first place? I guess that is due to the fact there is no string subtraction so MVEL figures these are numbers.
What I can offer you to try is to make sure MVEL understands these are integers by making the "(int)" denomination before the "vol_existingVolume.size_mb".
I will compile such a use-case and publish the results here.
2012-04-03 07:11 AM
Thanks guys, you're right. Manually casting the size_mb to int fixes it. Should've though about that myself... D'oh!
The volume object is from a finder, not sure why it treats these as string, but since I know how to fix it that's not a problem.