Showing strings from alert query in notification templates

Im having trouble finding out how to make showing string values work through templating. I have a query that finds the string name of some devices with a specific failed state and returns them. The alert query already works through returning 1 if there are found any names and 0 otherwise, but the problem is that i cannot see which devices are failed, only that one has. I want another query in the alert that returns the names themselves so i can see what devices to look at. So is there any way to extract a string field from a query into a notification template without it failing because there is a string value from the query?

It seems that this topic was closed, but im not sure how the solution works after looking at it and trying myself: