将十进制转换为整数m 4

问题描述

我有dataweave表达式,该表达式以十进制给出值,我想将其转换为整数 分配:$ .PBSI__Inventory__r [0] .PBSI__Real_Quantity__c,这类似于结果33.33,需要将其转换为33。 完整的Dataweave如下:

%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()函数舍入一个数字。

示例:

.click