Search code examples
muleanypoint-studiodataweave

How to calculate minimum in mule


I want to calculate the minimum of vars.a , vars.b , vars.d-vars.c

min[vars.a,vars.b,vars.d-vars.c] is not working 

Math.min(Math.min(vars.a,vars.b),vars.d - vars.c) is also not working

I m trying to add this logic in a transform and I am using mule version 4.0

what is the best way to compute this is in mule ?


Solution

  • In DataWeave you can calculate it as

    min([vars.a,vars.b,vars.d - vars.c])
    

    The parenthesis is missing in your code

    https://docs.mulesoft.com/mule-runtime/4.2/dw-core-functions-min