survey-analytics icon indicating copy to clipboard operation
survey-analytics copied to clipboard

Flatten the checkbox answers to separate columns in Tabulator

Open lkenny97 opened this issue 10 months ago • 1 comments

Is your feature request related to a problem? Please describe. I want to split the checkbox answers to separate column to be able to input the data to spss etc in the future.

Describe the solution you'd like Instead of having column header as "Question Name" and the value in the cell as ["Item 1", "Item 2"] I want to see something like "Question Name_Item 1" and "Question Name_Item 2" as columns and 1 in the first cell as value and 2 in the second. It can be done with an option such as flattenCheckboxOptions: true

Describe alternatives you've considered I can flatten everything myself before downloading the excel but the library should have this option because it exists for matrices anyway. Moreover, this is a standard in the research world.

lkenny97 avatar Jul 01 '25 18:07 lkenny97

Hi @lkenny97, Thank you for reaching out to us.

In SurveyJS Tabulator, each column corresponds to a survey question, each row to an individual response, and checkbox answers are typically shown as comma-separated values in a single cell.

If I understood your request correctly, you'd like to transform only checkbox question responses into a "flattened" format where each selected choice is represented as a separate column. For example:


Question Name: fav_cars. Choices: Car 1, Car 2, Car 3. User response 1: ["Car 1", "Car 2"] User response 2: ["Car 2"]

The transformed table would look like this:

fav_cars Car_1 fac_cars Car_2 fav_cars Car_3
1 2
1

In this table output, each choice appear as a separate column. Cell values appear accordingly to user selection: 1 = first selected item 2 = second selected item 3 = third selected item blank = not selected


Please let me know if I missed anything important. Additionally, please clarify how you wish to display answers for other question types in Tabulator? Should they remain in the default format (i.e., one column per question)?

I look forward to your reply.

JaneSjs avatar Jul 07 '25 14:07 JaneSjs