have a BOOK that has many EDITIONS.
BOOKs has a multivalued entityrelation field "book2edition" to it's EDITIONs.

i need a view that only displays ONE EDITION per BOOK: the first one, the one with delta=0

is this possible?
i know well how to use relations but not how to filter on a delta.

tried the following
* added a edition view
* added reverse"book2edition" relation as "book"
* added "book2edition" relation as "backtoeditions"
* filtered by "book2edition:delta" with all 3 possible tables (edition and the two relations)

none did work, as expected.

huh, don't know if this is
* a feature request - if this cannot be done now any way
* a support request - if this can be done with views or contrib or magick

#6 relationship_delta-1468862-6.patch3.53 KBlogaritmisk
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es).
[ View ]


Project:Views» Entity reference
Version:7.x-3.x-dev» 7.x-1.x-dev
Component:Views Data» Code

I'm a bit confused whether you use the relation or the entityreference module, though i assume you use the second one,
because with relation this wouldn't be too hard, because you can get a relationship to the relation.

Let's move to entityreference, because they could implement a custom relationship handler which adds the condition.

Title:Add a delta filter in the Views relationshipsFilter by entityreference field relation delta
Category:feature» support

I´m using Entity Reference for accomplishing something very simliar.

I have a node PHOTO with an entityrelation field that defines a target bundle to the node GALLERY. This allows every node 'gallery' to have references from nodes of type 'photo'. I would like to make a view that only displays one PHOTO per GALLERY, but I didn´t find how.

I was able to do the same in D6 by using node reference and node referrer modules: I established a relationship with 'Node Referrer' and then I chose 'Delta = 1' for displaying only the first item that has a reference to GALLERY. Is there a similar way for doing this with entityrelation or it is still not yet implemented?

so to summarize #2: seems to implement this in entityreference we can steal some code from references.module

Title:Filter by entityreference field relation deltaAdd a delta filter in the Views relationships
Category:support» feature

It seems to be a feature request then.

Title:Filter by entityreference field relation deltaAdd a delta filter in the Views relationships
Category:support» feature

I was curious if you found a way to do this?
I've kind of the same problem;

there are the content types; artist and paintings
every painting is linked to one artist via Entityreference
now i would like to create a view with all the artists and just show one random painting per artist... :)

any idea on how to acomplish this?

Status:Active» Needs review
new3.53 KB
PASSED: [[SimpleTest]]: [MySQL] 66 pass(es).
[ View ]

Shameless copy-and-paste from the relationships module. Haven't really tested it 100%, but I hope it works. Gonna test it more myself next week.

Please let know after tested so we can review.

Tested this, looks like it works. Thanks!

Ran into the same need for this feature which I also used in D6. Patch applies cleanly and works perfectly!

Status:Needs review» Reviewed & tested by the community

I'm regularly re-applying this patch after updating -dev and it's become pretty critical for some of my projects, so it'd be great to work toward getting this committed. Any maintainers willing to take a look? RTBC'ing to help move that along.

Exactly what we needed! #6 applies cleanly and works as designed.

+1 for RTBC


Works like a charm, thanks logaritmisk!!

RTBC for me too.

Issue summary:View changes
Status:Reviewed & tested by the community» Needs work

+      $join = $this->get_join();
+      if (
$this->options['delta'] != -1 && $field['cardinality']) {
$join->extra[] = array(
'field' => 'delta',
'value' => $this->options['delta'],
'numeric' => TRUE,
+        );
+      }

This feels like it should just be an override of get_join()?