I would like to know how to create a counter after a grid component so as to have a score for theses questions. For example, for each "X" in the array, the counter will be the same if the "X" is in the first column, +1 if it's in the second column...
My problem is principally i don't know how to find the number of the colum with the "X".
Thanks for you help
Comments
Comment #1
jimbullington commentedSorry, I'm not following you. Perhaps you could attach some screen shots to illustrate your problem further.
Comment #2
roderikI just tested a grid element, for another patch.
I had 5 questions (rows) defined, and the 4 columns (possible answers) have keys 'gridkey1' to 'gridkey4'.
I checked 2 answers and left the rest empty.
Here's an extract of the element's data from my {webform_submitted_data} table:
Answers are in the 'data' field, the questions are in the 'no' field. Also those without an answer.
This tells me that an SQL statement to do what you want, would be something like
SELECT [...], COUNT(d.no) FROM webform_submitted_data d WHERE [... AND] d.cid={cid for your grid element} GROUP BY [...], d.data
I don't know if that helps you...
This doesn't have much to do with the Webform Report module. This module lacks any proper support for 'grid elements' until now.
Comment #3
venezia commentedI'm sure that I will need to use this kind of SQL Statement.
I have a grid in which each column is a value and I want a new line that just display the total. (see picture, in this case I would like to display "total: 5")
Where should I had the code?
Thank you
Comment #4
roderikOh, you want to sum all different column values? Then don't group it, just get one number with
SELECT [...], SUM(CAST(d.data AS DECIMAL)) FROM webform_submitted_data d WHERE [... AND] d.cid={cid for your grid element} AND d.nid={your webform node}
I don't know where you should "had" the code. This seems too specific to put into the module, so you'll probably just want to get your own data & build your own HTML fragment to output, for this specific node.
...which you can do in nook_nodeapi('view') in a custom module (stick things in $node->content)
... or somewhere in a node-*.tpl.php / preprocess function in your theme. Most site builders probably prefer this. (There may also be other ways...)