When you add a webform likert field to a view, the join to the webform_submission table does not limit the results to just one row from each submission. If a likert has, say, 5 questions, then the view gets five rows. Adding "Distinct" to the view doesn't help: if you have 3 different answers, you get 3 rows of results.

For delta, this is handled in WebformSubmissionField::query() by adding delta = 0 to the query to prevent multi-answer items from causing the same problem. The following patch does the same for properties. It isn't actually necessary to return the data because it is submission entity is going to be created for display.

Comments

DanChadwick created an issue. See original summary.

danchadwick’s picture

Status: Active » Needs review
StatusFileSize
new903 bytes
norman.lol’s picture

Is this a duplicate of #3041878: Duplicate row results for some data types? Or just related?

danchadwick’s picture

@leymannx - I think these issues are opposite sides of the same coin. My approach was to ensure the query matches at most one row in the submission data table. This is the same approach taken by setting delta to 0. The actual submission is loaded as an entity during rendering; the actual fields in the view's query aren't used.

I'm *pretty* sure this approach would also solve the related issue, and certainly is a much smaller change.

jwineichen’s picture

Patch #2 has worked for me.

danchadwick’s picture

I'd like to get this committed if possible. This bug causes incorrect duplicate result rows when you include a likert or other component which uses multiple properties field values.

andileco’s picture

#2 worked for me too.

hdbonnett’s picture

The patch in #2 resolved this for my Likert fields as well.

andileco’s picture

Status: Needs review » Reviewed & tested by the community

Marking RTBC, as this is working for multiple people.

igonzalez’s picture

#2 worked for me too.

nathan tsai’s picture

nathan tsai’s picture

vladimiraus’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for your contribution.
Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.