Closed (duplicate)
Project:
Webform
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2008 at 21:10 UTC
Updated:
20 Jan 2008 at 01:09 UTC
I have a large multi-page webform with multiple fieldgroups. Each fieldgroup contains 10 questions - each weighted 1 - 10. When exporting to a CSV file the questions are not in order of fieldgroup, weight. But, ordered by weight alone.
The order is determined by the order of node->webformcomponents. This is set during node_load at line 150'ish in webform.module:
$result= db_query('SELECT * FROM {webform_component} WHERE nid = %d ORDER BY weight, name', $node->nid);
You can add the parent ID as a sort term and get the desired sorting (if your parents were created in the sort order you want)
$result= db_query('SELECT * FROM {webform_component} WHERE nid = %d ORDER BY pid, weight, name', $node->nid);
My SQL writing skills are not up to the task of joining the pid's weight so that the sort will work properly. Hope this helps other's export problems.
Comments
Comment #1
bassplaya commentedI've been looking for this for a long time.
It works great, even in Drupal 4.7 Thanx !!
Comment #2
quicksketchThanks, we put this in from this issue (same solution): http://drupal.org/node/190193.