conditions in relate-loop don´t work, want to filter by segment_2 Statamic 1.10.1

Whatý wrong with this code? (Statamic 1.10.1., just updated)

{{ entries:listing folder="termine" sort_by="sem_datum" sort_dir="asc" }}
<tr>class name and the like, removed for clarity </tr>
{{ related_doz }}{{ relate:name conditions="slug:segment_2" }} {{ title }}
{{ /relate:name }} {{ /related_doz }}
</tr>{{ /entries:listing }}

I want Statamic to loop through all Termine (classes) and only output the ones, where the slug of the related lecturer {{related_doz}} equals the slug od the page I´m on {{segment_2}}.

That would loop through all the courses and output all classes, that are held by the lecturer who´s page I´m seeing.

When I remove the condition and just use

```{{ relate:name }} {{ title }} | {{slug}} | {{segment_2}}{{ /relate:name }} Statamic will out put the proper values e.g.

  • Stephen Smith, stephen-smith, peter-miller
  • Peter Miller, peter-miller, peter-miller

I want only the 2nd row to show up. We´re one lecturer Miller´s page (semgnet_2 is peter-miller) and the slug of the relate-loop is also peter-miller. That means, this class is held by Mr Miller. Statamic should throw away the first loop of the relate-loop, because I don´t Mr. Smith´s classes here. So Statamic "knows" the proper values.

When I add the condition, Statamic outputs

  • Peter Miller, peter-miller, peter-miller
  • Peter Miller, peter-miller, peter-miller
  • and so forth.

Regardless ot the real lecturer Statamic outputs the name, slug & segment_2 of the lecturer page I´m on.

How can I achive my filtering?

Answered by Ville Vainio!
>>>>>>> Answered <<<<<<<
4 Replies