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
Comment #2
danchadwick commentedComment #3
norman.lolIs this a duplicate of #3041878: Duplicate row results for some data types? Or just related?
Comment #4
danchadwick commented@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.
Comment #5
jwineichen commentedPatch #2 has worked for me.
Comment #6
danchadwick commentedI'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.
Comment #7
andileco commented#2 worked for me too.
Comment #8
hdbonnett commentedThe patch in #2 resolved this for my Likert fields as well.
Comment #9
andileco commentedMarking RTBC, as this is working for multiple people.
Comment #10
igonzalez commented#2 worked for me too.
Comment #11
nathan tsai commentedRelated: #3000789: Views: Separate row per webform field
Comment #12
nathan tsai commentedComment #14
vladimirausThank you for your contribution.
Committed.