I am trying to concatenate all the id values present in "fields" Array in a single variable.
Input:
{
"rootId":"1oV_wWX-19utijBTxn1QHLsVFjvO-8DSG",
"jobName":"C##-#9-00057 Demand QA 1.1",
"folderName":"Billing",
"parentId":"188Hde_c_ZQiFQeSZX7IxCJGSWySWFOHn",
"includeSubfolder":true,
"files": [{
"id": "1JdVXF4EDI2if6kxTSTsYlYhmADeXZQf3",
"name":"Billing",
"mimeType": "application/vnd.google-apps.folder"
},
{
"id": "1KeYyslxo4ezNeuEdN4XrXrWvfaaKKvXU",
"name":"GoogleSheet1",
"mimeType": "application/vnd.google-apps.document"
},
{
"id": "1Poh5FMry692_0iFfmdcwtqT6RxeeoOt0",
"name":"Forms",
"mimeType": "application/vnd.google-apps.folder"
},
{
"id": "1NFQ_89UzVlLYduquZ4hsch4dB65h6fkv",
"name":"Zipfile.zip",
"mimeType": "application/zip"
}
]
}
The above is my input payload.
I am trying below Dataweave expression
%dw 2.0
output plain/text
var FileorFolderIds = ""
---
payload.files map (Sample, indexOfSamples) ->{
FileorFolderIds = FileorFolderIds ++ ',' ++ Sample.id
}
but giving me error.
Expected output:
FileorFolderIds = 1JdVXF4EDI2if6kxTSTsYlYhmADeXZQf3, 1KeYyslxo4ezNeuEdN4XrXrWvfaaKKvXU, 1Poh5FMry692_0iFfmdcwtqT6RxeeoOt0, 1NFQ_89UzVlLYduquZ4hsch4dB65h6fkv
like the above