{% with found = [] %} {% for obj in measurements %} {% if not found and data is not none and "object_id" in data and data.object_id == obj.object_id %} {{ obj.data['name']['text'] }} (#{{ obj.object_id }}) {% if found.append(true) %}{% endif %} {% endif %} {% endfor %} {% if not found %} {% if data.object_id %} #{{ data.object_id }} {% else %} — {% endif %} {% endif %} {% endwith %}