The join()
in your example isn’t doing anything.
Originally, join()
was being called as the last line in the expression, so the result of the join()
method was being output as the result of the expression. In your current example, you’re calling join()
, but not assigning the output of it anywhere, so it’s effectively a meaningless method call. You would want to assign the result of the join()
method call to a variable and then reference that variable.
weather = $context.response.data
alerts = isEmpty(weather.alerts) ? [] : weather.alerts
hasAlerts = count(alerts) > 0
myString = map(alerts, concat(x.event, " until ", formatDate(x.end * 1000, "h:mm a")))
myString = join(myString, "/r/n")
hasAlerts ? myString : "No alerts today!"
The only change I’ve made to your expression is in the second to last line to assign the output of the join()
method call to the variable that you use later.