1

I have many nodes of type 'Players' and 'Match'. In the 'Match' node there is an entity field 'Strikers' referenced to 'Players' which allow multiple values.

I'd like to create a player page that shows information about that player searching all occurrence of that player in the 'Match' nodes (inside the 'strikers' field of each node).

I tried with the contextual filter but I don't know if it is the correct way..

0

Going of memory here, this might be wrong:

Add contextual filter of node id (nid) (so the player nid goes here)

Add a RELANTIONSHIP of Strikers Referencing Entity and checkmark the box that says, "force relantionship" or something along those lines.

| improve this answer | |
  • I created a view with a path like 'player/%/info' and I add the contextual filter of node id (I use alias path, I hope it's not a problem). Then I create the relationship 'Content referencing Content from field_strikers'. Unfortunately I don't see any result in the preview.. – Andrea Moraglia Jan 5 '16 at 15:44
  • @AndreaMoraglia since your contextual filter is in the url, your view preview won't show any results. You need to go to, for example: /player/5/info to see if it works. OR temporarily change your contextual filter to fixed then enter 5 or a player nid there and then your preview will work. – No Sssweat Jan 6 '16 at 0:58
  • 1
    Thanks! I solved selecting "Content ID from URL" inside the contextual filter and using a relationship 'Content referencing Content from field_strikers'. Then I turned on the aggregation and the rows number in the result is the information I needed. Getting the Content ID from URL solved the problem of pahauto alias. I also insert the view as field inside player so when I see player profile I get the view at the bottom of the page. Thank You! – Andrea Moraglia Jan 7 '16 at 20:20
  • It's possible to filter the content ID on many field? I'd like to do the same query on more field ('strikers', 'substituted', 'cautioned' ecc..) then count the number of occurences – Andrea Moraglia Jan 10 '16 at 16:05
  • @AndreaMoraglia You would have to create a different view block for each. There is no way to count all of them at the same time. – No Sssweat Jan 10 '16 at 23:14

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.