Using Maestro 5.0.17 and the Calculation rule script:
When Amount - Decimal field (data.amount), Quantity - Currency field (data.quantity) and Shipping - Currency field (data.shipping) are entered by double-clicking from the left-side tree, this is the result using these values:
And when the plus signs added by Maestro to the +data.quantity fields are removed, there is no change in the calculation. However, when plus signs are added to the data.amount and data.shipping fields, such that
the calculation performs as expected:
Don't wish to tell learners to blindly add a plus in front of these fields without underlying explanation of why. Would appreciate some guidance on what to do or admission that this is something that needs to be addressed. Thank you.
I've modified one of your lines of code to reflect this:
return parseFloat(data.amount) * parseInt(data.quantity,10) + parseFloat(data.shipping);
Jason, thank you for your reply. Given that I'm not a coder, I asked around, and your response is solid. My concern is for the non-coders who are using these plug-n-play functions in Maestro to handle these very issues without having to know/perform additional coding on simple calculations such as this. I suppose had I just used a decimal or other dedicated number field for quantity vs. a text field, Maestro would have recognized it as a number and the (+) issue would have been a non-issue. I'll just have to be more careful with my examples moving forward. Thanks again.
I just found this article which should help:
Tips for working with Formulae and Text
You have identified a bug in Maestro. As you saw, references to the decimal fields were automatically prefixed with a + symbol to perform a conversion to a numeric value. This should also occur for currency fields as they also represent numeric data. This will be fixed for the next major release, along with better inline help resources in the new Code View.
The release I'm referring to is 5.1, due end of April. In the meantime please see the other workarounds described by Jason.