'validate integer value in mule 3 dataweave 1.0
I want to validate the field value as integer and make the test value as integer. In below code if the field value is string then I am getting error. Here I need to configure like if the value is not integer then make the test value is "" .
%dw 1.0
%output application/json
%var field="2312321a"
%function isEmpty(value) (value!=null and value!="")
---
{
test: field as :number as :string {format: "###"} as :number when isEmpty(field) otherwise ""
}
expected: eg: 123.44--> 123, 1234-> 1234, 123ab-> "", "" -> ""
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
