I am trying to map and join both firstName and lastName from a paxInfo array to produce a result like "Carlos Mendoza, Ana Mendoza, Sofia Mendoza" in one single expression.
My data structure:
"paxInfo": [
{
"firstName": "Klaudia",
"lastName": "Muster",
"gender": "Female",
"birthDate": "1972-01-27",
"age": 55,
"nationality": "Deutschland",
"nationalityCode": "DE",
"passportNr": "",
"isMainContact": true,
"loyaltyProgramMemberships": [],
"address": {},
"refId": "pax-1"
},
{
"firstName": "Alexander",
"lastName": "Muster",
"gender": "Male",
"birthDate": "1969-06-06",
"age": 57,
"nationality": "Deutschland",
"nationalityCode": "DE",
"passportNr": "",
"loyaltyProgramMemberships": [],
"refId": "pax-2"
}
]
What works perfectly:
{{join(map(5.data.data.attributes.pax.paxInfo; "firstName"); ", ")}}
â "Carlos, Ana, Sofia"
{{join(map(5.data.data.attributes.pax.paxInfo; "lastName"); ", ")}}
â "Mendoza, Mendoza, Mendoza"
What I tried - all fail with the same error:
{{join(map(5.data.data.attributes.pax.paxInfo; item.firstName + " " + item.lastName); ", ")}}
{{join(map(5.data.data.attributes.pax.paxInfo; item["firstName"] + " " + item["lastName"]); ", ")}}
{{join(map(5.data.data.attributes.pax.paxInfo; get(item; "firstName") + " " + get(item; "lastName")); ", ")}}
Error received:
Failed to map 'field.Pasajeros': Function 'join' finished with error!
Function 'map' finished with error! '{empty}' is not a valid key.
Current workaround:
{{join(map(5.data.data.attributes.pax.paxInfo; "firstName"); ", ") + " / " + join(map(5.data.data.attributes.pax.paxInfo; "lastName"); ", ")}}
â "Carlos, Ana, Sofia / Mendoza, Mendoza, Mendoza"
This works but produces all firstnames and all lastnames after and not the desired firstName lastName per passenger format.
My question:
Is there any supported syntax in make.com to combine two fields from the same array item inside a map() function? A formular should include 1 or many passengers.
Thanks a lot!