如何在Mule Dataweave中进行长度验证
%dw 1.0
%output application/xml
---
(payload default []) map {
Field1:$.Field11,
Field2:$.Field22,
Field3:$.Field33,
Field4:$.Field44
}
我想做max Length of Field22 < 20
如何在Mule Dataweave中实现这一目标
答案 0 :(得分:2)
您可以使用sizeOf运算符在invidual字段上使用when条件:
%dw 1.0
%output application/xml
---
(payload default []) map {
Field1:$.Field11,
(Field2: $.Field22) when (sizeOf $.Field22) < 20,
Field3:$.Field33,
Field4:$.Field44
}