Active IQ Unified Manager Discussions

MVEL calculation issue

hland
4,680 Views

Hi,

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:

Thanks

Hendrik

1 ACCEPTED SOLUTION

goodrum
4,680 Views

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? 

View solution in original post

5 REPLIES 5

goodrum
4,681 Views

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? 

yaronh
4,680 Views

Hi Hendrik,

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.

Best,

Yaron

hland
4,680 Views

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.

..- Hendrik

bdave
4,680 Views

What version of WFA are you using?  WFA 1.1 or an earlier version?

Thanks,

Dave

hland
4,680 Views

I'm using 1.1. Anyway, I can easily solve this as suggested by others above...

..- Hendrik

Public