1

In a custom module of mine (Drupal 8.2.6), I have two custom entities A and B with a one to many relationship from A to B.
I use Views (table view) to display content of A and B and by default I get this:
Field1 (from A) Field2 (from B)
xxx aaa
yyy bbb
yyy ccc
zzz ddd
I'd like to NOT display yyy the second time.
How can I do that?

[Edit] just an example, instead of what is (by default) on the left, I'd like what is on the right of the picture:
example

2
  • What exactly you want instead of yyy bbb, yyy ccc?Those two results are different (result, row in your table, is Field1 AND Field2), that is why there are both of them. From Views point of view, there is no redundancy there.
    – tdd
    Mar 20 '17 at 10:08
  • I'd like the "redundant" information (i.e. yyy in my example) to be blank. See the example I added to my question.
    – gbmapo
    Mar 20 '17 at 10:31
1

You can try Views Field View module.

  1. Create a "secondary" view of Field2 contextualy filtered by relationship with EntityA.
  2. In your main view, use Field1 and new Views Field of your "secondary" view (this field type is added by module).
  3. Set up that new Views Field in your view to pass proper argument to "secondary" view contextual filter (and therefore show relevant Field2s related to EntityA)
0
0

Finally I found another solution using Rewrite Results.
Depending on another field (which can be hidden), I output 'nothing' or 'the content':

Rewrite Results

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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