Rules and Expressions with Open Weather API

If it’s an array, using the map() concept below accounts for this.

Otherwise, using a conditional ternary expression works:

condition ? trueOperation : falseOperation

Since it’s an array, I would probably use a map() and join() to handle it.

alerts = $context.response.data.alerts
myString = map(alerts, concat(x.event, " until ", formatDate(x.end * 1000, "h:mm a")))
join(myString, "\r\n")

The General Functions in Expressions documentation covers the basics above the above functions or you can search the community as there were a few recent posts about expressions and arrays that may be helpful. This discussion links to a few Array related discussions of interest.

The \r\n in my example above inserts a new line (Carriage Return / Line Feed). It won’t show up in the variable preview or variable editor, but it will in a notification or a dashboard variable tile.