Webform Export Option "Separate, with each possible option value in its own column" Doesn't Show Values for Specific Options

Created on 19 July 2024, 3 months ago
Updated 22 July 2024, 3 months ago

Problem/Motivation

When using the Webform module in Drupal 10, the export setting "Options single value format: Separate, with each possible option value in its own column" does not display values for specific options in the exported data. However, these values are shown correctly when the setting is switched to "compact" format. This inconsistency affects the ability to correctly export and analyze submission data when using the separated column format. This happens for type field -> Options when option value is integer, when string is working correctly.

Steps to reproduce

Setup a Webform:

Create a Webform with a field having multiple selectable options (
Configure Export Settings:

Navigate to the Webform submission export configuration.
Set the "Options single value format" to "Separate, with each possible option value in its own column".
Submit the Form:

Fill out and submit the Webform multiple times with different values for the option field.
Export Submissions:

Export the Webform submissions using the above export setting.
Observed Behavior:

Setting: "Separate, with each possible option value in its own column": - values not shown correctly.

When the setting is switched to "compact", the values are displayed correctly in the export file.

Proposed resolution

Investigate and update the logic responsible for exporting webform submissions when using the "Separate, with each possible option value in its own column" setting. Ensure that each option value is correctly included in its respective column in the export file, similar to how it is correctly handled in the "compact" format.

Remaining tasks

Analyze the current implementation of the export functionality in the Webform module.
Identify the root cause of the issue with the "Separate, with each possible option value in its own column" setting.
Implement a fix to ensure all option values are exported correctly.

🐛 Bug report
Status

Needs review

Version

6.2

Component

Code

Created by

🇧🇬Bulgaria Ana Bozhilova

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Ana Bozhilova
  • 🇧🇬Bulgaria Ana Bozhilova

    The attached patch is fixing the desribed bug:

    $option_value = (string) $option_value;: This line explicitly casts $option_value to a string. This ensures that the key is treated as a string in subsequent operations, which is important for consistency, especially when the keys are integers or other types that need to be compared or processed as strings.

  • Status changed to Needs review 3 months ago
Production build 0.71.5 2024