Forum Discussion
Hello @sravan,
In order to achieve the wanted transformations you can use two Mapper Snaps.
The first one with Mapping Root set to $cover[*] and mapping the elements of the cover array.
And the second Mapper to rename the cover array to ppCover.
Also, here is a sample pipeline:
sl-comm-transform-array_2023_05_31.slp (6.2 KB)
Try this out, and let me know if this helps you.
BR,
Aleksandar.
Or you can use the following map function in one Mapper Snap:
$cover.map(x => {
"needCode":x.needCode,
"needKindName":x.needKindName,
"rates": x.hasPath("coverAmount") ? [{
"type":"Cover Amount",
"amount":{
"value":x.coverAmount.amount,
"currencyCode":x.coverAmount.currencyCode.toLowerCase()
}
}] : []
})
If you ask me, I would suggest going with the first approach if possible, since it is cleaner and easier to maintain.
Try both ways and let me know.
- bojanvelevski4 years agoValued Contributor
Hey @amardeep2021,
Add your S3 bucket path to a Directory Browser, following a ZipFile Read snap with $Path added in the “File” field. Don’t forget to check the equal sign to enable expressions.
Hope this helps,
Regards,
Bojan - amardeep20214 years agoNew Contributor III
Thanks Bojan. I have tried the same. But, I don’t see the directory browser output in the zip file reader snap File field. Am I missing something? Please let me know.
Regards,
Amar.- bojanvelevski4 years agoValued Contributor
Write down the $Path field even if it doesn’t show up in the input schema. It must be a glitch or something. Here’s the result:
- amardeep20214 years agoNew Contributor III
It works! Thanks Bojan.
Related Content
- 4 years ago
- 3 months ago