#StackBounty: #8 #views How to create a view printing the latest 3 nodes with unique entity reference values

Bounty: 50

I have two content types, CAR and DRIVER. The DRIVER content type contains a CAR entity reference field. So each DRIVER node creation page can reference a specific CAR.

The goal is to build a view to print out 3 of the most recent unique CARs referenced from a DRIVER node (created by the logged-in user).

Example… here are 6 of the most recently created DRIVERS by a particular user.

  • Driver 1 – BMW
  • Driver 2 – BMW
  • Driver 3 – Mercedes
  • Driver 4 – BMW
  • Driver 5 – Audi
  • Driver 6 – Mercedes

The goal is to display 3 of most recent unique CARS referenced, like so…

  • Driver 1 – BMW
  • Driver 3 – Mercedes
  • Driver 5 – Audi

The closest solution I’ve found is using Aggregation in views, but the sort order by Created Date doesn’t actually sort them correctly.

I’m open to building this outside of views also. Any suggestions? Thanks!

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.