If I have a matrix field with 2 fields "Name" and "Entry" is it possible to lookup the first row in that matrix field which has a specific "Name"?
Context: Twig template.
According to this answer the only ways to filter matrix blocks are by type, or by position. So you need to use the if
condition on the twig for tag.
{% for m in entry.myMatrix if m.theName == nameImLookingFor %}
{% if loop.index == 1 %}
got the first one, it is {{m.theName}}
{% endif %}
{% endfor %}
If you don't want to loop over all of the blocks, you can also install the mnbreakandcontinue plugin and break out of the loop after the first match:
{% for m in entry.myMatrix if m.theName == nameImLookingFor %}
got the first one, it is {{m.theName}}
{% break %}
{% endfor %}