将小数转换为整数 mule 4

Converting decimal to integer mule 4

我有 dataweave 表达式,它以十进制给出值,我想将其转换为整数 allocation: $.PBSI__Inventory__r[0].PBSI__Real_Quantity__c,这样得到的结果是33.33,需要转换成33。 完整数据编织如下:

%dw 2.0
output application/xml
---
{
    inventory @(xmlns:"http://www.demandware.com/xml/impex/inventory/2007-05-31"):{
    "inventory-list": {
        header @("list-id":"Hastens_Inventory"):
         { 
             "default-instock":false,
             "use-bundle-inventory-only":false
         },
         records: {(payload map
         {
             record @("product-id": $.PBSI__Item__r.Name): {
                 allocation: $.PBSI__Inventory__r[0].PBSI__Real_Quantity__c,// **output value 33.33, expected output 33**
                 "allocation-timestamp": now()
             }
         })}

    }
}
}

使用 floor() 函数对数字进行四舍五入。

示例:

%dw 2.0
output application/json
var value=33.33
---
{
    original: value,
    floor: floor(value)
}