Hi,
I currently have a table, which takes textarea submissions from webform into views. However, the textarea has a limit of 250 words but the data table uses varchar and 341 characters so is not showing all of the submissions.
Can I simply can the field type in phpmyadmin? I've tried changing it in the Drupal back end but it says: Cannot change field.
This is the export of the table if that helps
$data_table = new stdClass;
$data_table->disabled = FALSE; /* Edit this to true to make a default data_table disabled initially */
$data_table->api_version = 1;
$data_table->title = 'Webform views online application form';
$data_table->name = 'webform_views_online_application_form';
$data_table->table_schema = array(
'description' => 'VIEW',
'fields' => array(
'sid' => array(
'type' => 'int',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => '',
),
'uid' => array(
'type' => 'int',
'size' => 'normal',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => '',
),
'killer_question_1_answer' => array(
'type' => 'varchar',
'size' => 'normal',
'length' => '341',
'not null' => FALSE,
'description' => '',
),
'killer_question_2_answer' => array(
'type' => 'varchar',
'size' => 'normal',
'length' => '341',
'not null' => FALSE,
'description' => '',
),
'killer_question_3_answer' => array(
'type' => 'varchar',
'size' => 'normal',
'length' => '341',
'not null' => FALSE,
'description' => '',
),
'killer_question_4_answer' => array(
'type' => 'varchar',
'size' => 'normal',
'length' => '341',
'not null' => FALSE,
'description' => '',
),
'killer_question_5_answer' => array(
'type' => 'varchar',
'size' => 'normal',
'length' => '341',
'not null' => FALSE,
'description' => '',
),
'job_reference' => array(
'type' => 'varchar',
'size' => 'normal',
'length' => '341',
'not null' => FALSE,
'description' => '',
),
'job_title' => array(
'type' => 'varchar',
'size' => 'normal',
'length' => '341',
'not null' => FALSE,
'description' => '',
),
'submitted' => array(
'type' => 'datetime',
'size' => 'normal',
'not null' => FALSE,
'description' => '',
),
'remote_addr' => array(
'type' => 'varchar',
'size' => 'normal',
'length' => '128',
'not null' => FALSE,
'description' => '',
),
),
'name' => 'webform_views_online_application_form',
);
$data_table->meta = array(
'join' => array(
'webform_submissions' => array(
'left_field' => 'sid',
'field' => 'sid',
'inner_join' => '0',
),
'users' => array(
'left_field' => 'uid',
'field' => 'uid',
'inner_join' => '0',
),
),
);
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | webform_mysql_views-1101954-12.patch | 1.13 KB | michaellenahan |
Comments
Comment #1
netivajak commentedLooking into this with KC and determined the issue to be with the group_concat_max_len. Setting this to a higher value (e.g. 8192) than the 1024 default allows larger fields (e.g. textareas) to return the whole value.
However I note around line 340 of webform_mysql_views.module that there is a note in the function webform_mysql_views_build_query that there is a workaround in place to avoid problems with the 1024 group_concat_max_len default. This workaround appears not to be working - at least in this particular instance.
As noted in the module file, one resolutions is to use something like the following in my.cnf:
[mysqld]
group_concat_max_len = 8192
But of course that's not going to be helpful for everyone.
I've tried changing the webform_mysql_views_build_query function to set group_concat_max_len without success - any thoughts?
Comment #2
cafuego commentedYou can change the size limit on the text field using hook_form_alter() or by copying the webform textfield component to a custom one and using that instead. I'm assuming you're unable to add 341 characters on the webform?
Comment #3
ydahiAny update on this?
I'm using 7.x-1.0 and running into the same issue.
The textarea in my webform is being used to hold a large list of names. However, it seems that the column is set to varchar(341) and cannot be changed.
There are two things to note:
(1) When viewing the submission (i.e. node/*/submission/*), all of the input is visible, ie. there is no cut off
(2) When using Views-3 to display the field, only a limited amount of the input is shown
Any help would be greatly appreciated.
Comment #4
cafuego commentedOk, your issue is definitely because of the default lower value for group_concat_max_len then.
Comment #5
cafuego commentedThe only way to fix your issue is by setting group_concat_max_len in the mysql server configuration, or by passing a setting when Drupal connects to the database.
According to #1309278: Make PDO connection options configurable the latter is now possible in Drupal 7.
So what you need to do is add some configuration to your settings.php file. Specifically, you need to add
init_commandsto the SQL section of the file:.. see how you go and please let us know. We can then update the docs.
Comment #6
aganz commented#5 works like a charm, great solution for people without root access
Comment #7
cafuego commentedComment #8
cafuego commentedComment #9
wdseelig commentedThis issue is not completely fixed -- at least not as of 6.x-1.3.
If you can't change group_concat_max_len [and godaddy will not let me do so] then you have no way of getting around this problem.
EXCEPT. The place in the webform_mysql_views module that retrieves the webform data is around line 352 and contains the following code:
$component = sprintf("(SELECT GROUP_CONCAT (data) FROM {webform_submitted_data} AS child WHERE child.sid = parent.sid AND cid = %d) AS `%s`, ", $row['cid'], $row['form_key']);
Simply remove the GROUP_CONCAT from this code, and you'll find that the table stores the data as a longtext instead of a varchar(341).
Bigger point: Why would be need to be doing a GROUP_CONCAT anyway? For a given (sid,cid) combination there would only be ONE data field, right??
Comment #10
argol_0 commented#9 Excellent solution thanks for the help, very useful
Comment #11
michaellenahan commented#9 Thank you.
My specific problem was with a webform view (supplied by the webform_view module), where the data was being truncated at 341 characters, but this approach should work with other fields where the data is being truncated.
As suggested at #9, I removed the GROUP_CONCAT for the field, and now I get a mediumtext field in mysql instead of a varchar(341).
(I also wonder whether the GROUP_CONCAT is necessary at all).
Comment #12
michaellenahan commentedHere is a patch.
Comment #13
xamanu commentedAs this is still an issue for the Drupal 7 version of this module I reopen this issue with update meta tags. Please review and commit to the module. Thanks.
Comment #14
akshita commentedHi michaellenahan
Your patch did not work. I just changed the Case 'view' to case 'textarea' and that worked.
But there is another problem.
For the comment field:
The longest text appears empty but when you copy it into Notepad it is all there .
I wonder if a size limit should be put in place?
The patch changed the Comment field (textarea) from varchar(341) to mediumtext.
Thanks
Rev
Comment #15
quindio commentedAbout 2 years ago I ran into the problem of the 341 chars and #9
worked then but I tried today and it did not worked any more.
OK, I managed to by pass this problem by doing the following,
Since I already do a query that gets the information from the
webform_mysql_views table:
$query = "SELECT sid, uid FROM { webform_views_name_of_form } ;
while ($r = db_fetch_array($query))
To get the information from the 'data' field in the webform_submitted_data,
I use the returned sid ($r['sid']) from my first query and the cid=8
(in my case I had 14 fields in my form, and the 8th field is the one with the information I needed)
/***************/
$query2 = sprintf("SELECT data FROM { webform_submitted_data } AS child WHERE child.cid=8 and sid=%d", $r['sid']);
$q2 = db_query($query2);
$r2 = db_fetch_array($q2);
//print($r2['data']);
/****************/
This is working for me but if you guys see a problem, let me know.
Thanks,