2

I have an event system which uses the date repeat entity to clone repeating events and another section which uses the similar by terms module to create a view of events related to the article.

However I want to filter out the repeating events, is there a way of adding a condition that if the titles match then ignore them?

2 Answers 2

1

There are three ways I can think of to do this :

  1. By using hook_views_query_alter, which I can say would be the best option.
  2. Write custom code in template/module wherever it suits you, just views_embed_view and pass arguments programmatically.
  3. The Bad but Quick Way : Use php filter in view's contextual filter. I would suggest not to go this way.

Use one of these ways only if answer by Pierre.Vriens doesn't work for you. :)

1

Consider looking at the Views Distinct module to do this ... Here are some details about this module (from its project page):

Relationships or other joins in Views often create "duplicate" results. For example, a node with a field that has multiple values may show up in the View once per value in the multi-value field. It's frustrating, and the "DISTINCT" SQL query option in the Views UI does not actually solve the problem because the result row is technically distinct. This module aims to give a simple GUI method to remove or aggregate these "duplicate" rows.

For any given field, including "Global: Text" fields, you can optionally mark the field as filtered ("Filter Repeats") or aggregated ("Aggregate Repeats"). All rows with the same value in that field will either be removed as duplicates (filtered), or aggregated in-line.

The "value" of the field as used for filtering or aggregation can be taken pre-render (fastest and totally cacheable), or post-render (after any rewrite rules or other transformations have occurred). Post-render actions are a bit slower (the View must be re-rendered, though the query is not re-run), but also work with Global fields, like Global: Text w/rewrite rules.

If this doesn't work for you, or for some reason you cannot / do not want to use this module, then consider any of the alteratives suggested by Sumit Madan ... (+1 !).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.