The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Export Submissions with one column per radio option - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Modules / Other (https://forums.formtools.org/forumdisplay.php?fid=8)
+--- Forum: Modules (https://forums.formtools.org/forumdisplay.php?fid=16)
+--- Thread: Export Submissions with one column per radio option (/showthread.php?tid=1949)



Export Submissions with one column per radio option - philou - Mar 13th, 2012

Hi,
how would I go about exporting the submissions in an Excel layout where I have one column per option, as defined in my option lists for the form fields?

Example:
Question 1 – your favourite colour? Options: green, blue, red
Question 2 – are you vegetarian? Options: yes, no, sometimes

I would like to export the answers as follows (I am using newlines here to represent separate columns)

green:
blue: X
red:
yes:
no:
sometimes: X

Reason for this is, that I can more easily give my client an Excel sheet which they can add up by simply counting the cells with values. If we have a column with cells that contain either "green", "blue" or "red", counting the number of answers is difficult. The client wants excel and not a solution where they use the report tool inside formtools.

If it's best done via the smarty templates, then where can I find out what smarty tags to use to get to the options in an option list for a field?

Many thanks for any pointers!
philou


RE: Export Submissions with one column per radio option - philou - Mar 17th, 2012

I have solved it myself. A custom SQL query seemed the quickest way. In case someone else wants to achieve the same thing, below is the query. Just replace:
- your table name in the database
- names of your columns
- values of radio buttons

Code:
SELECT submission_id AS 'id',
    
    CASE WHEN question_1 = '1' THEN 1 END AS 'green',
    CASE WHEN question_1 = '2' THEN 1 END AS 'blue',
    CASE WHEN question_1 = '3' THEN 1 END AS 'red',

    CASE WHEN question_2 = '1' THEN 1 END AS 'yes',
    CASE WHEN question_2 = '-1' THEN 1 END AS 'no',
        CASE WHEN question_2 = '0' THEN 1 END AS 'sometimes'

FROM ft_form_1 WHERE 1

p.