Skip to content

Instantly share code, notes, and snippets.

@jam01
Created May 25, 2017 15:33
Show Gist options
  • Save jam01/e29cde7814612b07130f4723da1e218c to your computer and use it in GitHub Desktop.
Save jam01/e29cde7814612b07130f4723da1e218c to your computer and use it in GitHub Desktop.
This script will concatenate a regular persons's name into a string while skipping null & empty strings.
%dw 1.0
%output application/json
---
{
result: [
payload.person.firstName,
payload.person.middleName,
payload.person.lastName
]
filter $ != null
reduce ($$ ++ " " ++ $)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment