我的輸入JSON如下dataweave總和功能: -JSON爲xml使用
{
"Studentvalue": [
{
"StudentDetails": {
"valueId": "default",
"reason": "default",
"type": "high",
"Schoolbudget": [
{
"Id": "100",
"Age": "23"
},
{
"Id": "101",
"Age": "24"
},
{
"Id": "102",
"Age": "25"
}
],
"isApplicable": "boolean",
"isNotified": "boolean"
}
}
]
}
輸出XML是:
<schoolmemo>
<active>yes<active>
<schooltype>Primary<schooltype>
<validity>?<validity>
</schoolmemo>
我有一個條件,如果在JSON 「AGE」 字段的總和大於比100中的有效性標籤的值是'yes'else'no'
你能幫助我如何在數據編輯中使用sum函數來驗證有效性字段嗎?重要的一點是我正在獲取「age」字段的數組JSON。
乾杯, Bsolver
here ..%var agescombined將無法正常工作,因爲我正在獲取年齡值數組我想在這裏結合所有年齡:-23 + 24 + 25 請告訴我如何總結所有年齡段在排列比應用條件 – Isranis
Yevgeniy的答案是正確的,試試看。 payload.StudentDetails.StudentType.Age產生一個數組。你可以把它寫成payload.StudentDetails。* StudentType.Age這使得它更清晰,但結果是一樣的。 –
沒有它的不工作它給出了一個錯誤「null到數組」,我已經更新了我的JSON與準確的領域,你可以請現在幫助我...對不起一個更新: - (....我必須做總結年齡23 + 24 + 25,並進行驗證。 – Isranis