Comments

danchadwick’s picture

Category: Bug report » Support request
Status: Active » Fixed

No clue, since you didn't provide enough to help you.

I suggest you look at the built in view that generates the results table to see how it should be configured. Also look at the generated query.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

kumkum29’s picture

Hello,

I have the same problem. Datas aren't displaying when we use the field "Webform submission data: All values"...

Have you any idea for resolve this problem?

Thanks.

carcheky’s picture

same problem, but not see where this issue is fixed....

carcheky’s picture

Status: Closed (fixed) » Active
joelhsmith’s picture

I'm having the same problem. Using Views 7.x-3.13 with Webform 7.x-4.12. Shouldn't this show a field with webform submission data from any webform?

$view = new view();
$view->name = 'test';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'webform_submissions';
$view->human_name = 'test';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'test';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Webform submissions: Serial number */
$handler->display->display_options['fields']['serial']['id'] = 'serial';
$handler->display->display_options['fields']['serial']['table'] = 'webform_submissions';
$handler->display->display_options['fields']['serial']['field'] = 'serial';
/* Field: Webform submission data: All values */
$handler->display->display_options['fields']['webform_all_fields']['id'] = 'webform_all_fields';
$handler->display->display_options['fields']['webform_all_fields']['table'] = 'webform_submissions';
$handler->display->display_options['fields']['webform_all_fields']['field'] = 'webform_all_fields';
$handler->display->display_options['fields']['webform_all_fields']['label'] = '';
$handler->display->display_options['fields']['webform_all_fields']['format'] = 'text';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test';
cobadger’s picture

Title: Views field "Webform submission data: All values" is empty when the webform submissions are added as a relatonehip » Views field "Webform submission data: All values" is empty when the webform submissions are added as a relatonship
cobadger’s picture

Title: Views field "Webform submission data: All values" is empty when the webform submissions are added as a relatonship » Views field "Webform submission data: All values" is empty when the webform submissions are added as a relationship
cobadger’s picture

I can confirm that this problem exists. We're using Webform Version: 7.x-4.12 and Views Version: 7.x-3.13.

To recreate the problem:

  1. Clone the view 'Webform Results' provided by the module in webform/views/default_views/webform_results.inc.
  2. Choose a webform node id from your site
  3. Enter that nid as the contextual filter in the view edit form
  4. Make note of the db query
  5. Replace the contextual filter by setting a static filter with the same nid in the 'filter criteria' section of the view edit form; remove the contextual filter
  6. Make note of the revised db query

The result that we observe is that once the contextual filter is removed, none of the data from "Webform submission data: All values" appear in the view results.

We discovered that with the exception of a space in the 'WHERE' clause, the database queries are identical.

Here's the diff between the 'Webform Results' view and the view after being modified per the above (our webform node id is 54):

diff --git a/from_module.php b/from_module.php
index 2d70e66..ea02cee 100644
--- a/from_module.php
+++ b/from_module.php
@@ -120,14 +120,8 @@ $handler->display->display_options['fields']['webform_all_fields']['label'] = ''
 $handler->display->display_options['fields']['webform_all_fields']['exclude'] = TRUE;
 $handler->display->display_options['fields']['webform_all_fields']['alter']['nl2br'] = TRUE;
 $handler->display->display_options['fields']['webform_all_fields']['format'] = 'text';
-/* Contextual filter: Webform submissions: Node */
-$handler->display->display_options['arguments']['nid']['id'] = 'nid';
-$handler->display->display_options['arguments']['nid']['table'] = 'webform_submissions';
-$handler->display->display_options['arguments']['nid']['field'] = 'nid';
-$handler->display->display_options['arguments']['nid']['default_action'] = 'not found';
-$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed';
-$handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
-$handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
-$handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
-$handler->display->display_options['arguments']['nid']['specify_validation'] = TRUE;
-$handler->display->display_options['arguments']['nid']['validate']['type'] = 'node';
+/* Filter criterion: Webform submissions: Node */
+$handler->display->display_options['filters']['nid']['id'] = 'nid';
+$handler->display->display_options['filters']['nid']['table'] = 'webform_submissions';
+$handler->display->display_options['filters']['nid']['field'] = 'nid';
+$handler->display->display_options['filters']['nid']['value']['value'] = '54';

Here's our db query from the 'Webform Results' view, using our nid = 54 as the value of the contextual filter:

SELECT webform_submissions.serial AS webform_submissions_serial, webform_submissions.sid AS sid, webform_submissions.nid AS webform_submissions_nid, webform_submissions.is_draft AS webform_submissions_is_draft, webform_submissions.submitted AS webform_submissions_submitted, users_webform_submissions.name AS users_webform_submissions_name, users_webform_submissions.uid AS users_webform_submissions_uid, webform_submissions.remote_addr AS webform_submissions_remote_addr
FROM 
{webform_submissions} webform_submissions
LEFT JOIN {users} users_webform_submissions ON webform_submissions.uid = users_webform_submissions.uid
WHERE (( (webform_submissions.nid = '54' ) ))
ORDER BY webform_submissions_serial DESC
LIMIT 50 OFFSET 0

Here's our db query from the view after being modified per the above:

SELECT webform_submissions.serial AS webform_submissions_serial, webform_submissions.sid AS sid, webform_submissions.nid AS webform_submissions_nid, webform_submissions.is_draft AS webform_submissions_is_draft, webform_submissions.submitted AS webform_submissions_submitted, users_webform_submissions.name AS users_webform_submissions_name, users_webform_submissions.uid AS users_webform_submissions_uid, webform_submissions.remote_addr AS webform_submissions_remote_addr
FROM 
{webform_submissions} webform_submissions
LEFT JOIN {users} users_webform_submissions ON webform_submissions.uid = users_webform_submissions.uid
WHERE (( (webform_submissions.nid = '54') ))
ORDER BY webform_submissions_serial DESC
LIMIT 50 OFFSET 0

To reiterate, the view as modified contains no values for the 'Webform submission data: All values' views field.

Note that we have not changed the "exclude from display" setting for this field from the original:

$handler->display->display_options['fields']['webform_all_fields']['exclude'] = TRUE;

I'm not sure how this data appears in the 'Webform Results' view as provided by the module, but it does.

joelhsmith’s picture

@COBadger Thank you for confirming. Are you suggesting the module needs a patch?

cobadger’s picture

@joelhsmith I believe that it does. My take is that the hook_views_pre_view() function looks for a webform nid only as its first argument and won't attach webform component results unless it finds a webform nid as the first argument.

To generalize, the view could be built with a webform nid coming from one of three places:

  1. An exposed filter
  2. A set filter, or
  3. An argument (that may not be the first argument in the view)

Please see the attached patch to address each of these possibilities.

cobadger’s picture

Revised patch to remove debugging call.

cobadger’s picture

Status: Active » Needs review

Status: Needs review » Needs work
cobadger’s picture

Revised patch.

cobadger’s picture

Revised to better handle views filters

joelhsmith’s picture

@COBadger Thank you for working on this. I ran the #16 patch, and I followed your instructions to attempt to replicate, but the data is still missing, from the "Webform submission data: All values". Below is my views export:

$view = new view();
$view->name = 'webform_results';
$view->description = '';
$view->tag = 'webform';
$view->base_table = 'webform_submissions';
$view->human_name = 'Webform Results';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '50';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options'] = '10, 50, 100, 200, 500, 1000';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options_all'] = TRUE;
$handler->display->display_options['pager']['options']['expose']['items_per_page_options_all_label'] = 'All';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'view_submission' => 'view_submission',
  'submitted' => 'submitted',
  'name' => 'name',
  'remote_addr' => 'remote_addr',
);
$handler->display->display_options['style_options']['default'] = 'view_submission';
$handler->display->display_options['style_options']['info'] = array(
  'view_submission' => array(
    'sortable' => 1,
    'default_sort_order' => 'desc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'submitted' => array(
    'sortable' => 1,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'name' => array(
    'sortable' => 1,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'remote_addr' => array(
    'sortable' => 1,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
  'webform_all_fields' => array(
    'sortable' => 1,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
    'empty_column' => 0,
  ),
);
$handler->display->display_options['style_options']['sticky'] = TRUE;
$handler->display->display_options['style_options']['empty_table'] = TRUE;
/* Header: Global: Result summary with an additional token to change the items/page */
$handler->display->display_options['header']['webform_result']['id'] = 'webform_result';
$handler->display->display_options['header']['webform_result']['table'] = 'views';
$handler->display->display_options['header']['webform_result']['field'] = 'webform_result';
$handler->display->display_options['header']['webform_result']['content'] = '<div class="webform-results-per-page">Showing @start - @end of @total. &nbsp; @items_per_page_links</div>';
/* No results behavior: Global: Unfiltered text */
$handler->display->display_options['empty']['area_text_custom']['id'] = 'area_text_custom';
$handler->display->display_options['empty']['area_text_custom']['table'] = 'views';
$handler->display->display_options['empty']['area_text_custom']['field'] = 'area_text_custom';
$handler->display->display_options['empty']['area_text_custom']['empty'] = TRUE;
$handler->display->display_options['empty']['area_text_custom']['content'] = 'There are no submissions for this form. <a href="/node/!1">View this form</a>.';
$handler->display->display_options['empty']['area_text_custom']['tokenize'] = TRUE;
/* Relationship: Webform submissions: User */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'webform_submissions';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
/* Field: Webform submissions: View link */
$handler->display->display_options['fields']['view_submission']['id'] = 'view_submission';
$handler->display->display_options['fields']['view_submission']['table'] = 'webform_submissions';
$handler->display->display_options['fields']['view_submission']['field'] = 'view_submission';
$handler->display->display_options['fields']['view_submission']['label'] = '#';
$handler->display->display_options['fields']['view_submission']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['view_submission']['text'] = '[serial]';
$handler->display->display_options['fields']['view_submission']['access_check'] = 0;
/* Field: Webform submissions: Submitted */
$handler->display->display_options['fields']['submitted']['id'] = 'submitted';
$handler->display->display_options['fields']['submitted']['table'] = 'webform_submissions';
$handler->display->display_options['fields']['submitted']['field'] = 'submitted';
$handler->display->display_options['fields']['submitted']['date_format'] = 'short';
$handler->display->display_options['fields']['submitted']['second_date_format'] = 'long';
/* Field: User: Name */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'users';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['relationship'] = 'uid';
$handler->display->display_options['fields']['name']['label'] = 'User';
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
/* Field: Webform submissions: Remote address */
$handler->display->display_options['fields']['remote_addr']['id'] = 'remote_addr';
$handler->display->display_options['fields']['remote_addr']['table'] = 'webform_submissions';
$handler->display->display_options['fields']['remote_addr']['field'] = 'remote_addr';
$handler->display->display_options['fields']['remote_addr']['label'] = 'IP address';
/* Field: Webform submission data: All values */
$handler->display->display_options['fields']['webform_all_fields']['id'] = 'webform_all_fields';
$handler->display->display_options['fields']['webform_all_fields']['table'] = 'webform_submissions';
$handler->display->display_options['fields']['webform_all_fields']['field'] = 'webform_all_fields';
$handler->display->display_options['fields']['webform_all_fields']['label'] = '';
$handler->display->display_options['fields']['webform_all_fields']['exclude'] = TRUE;
$handler->display->display_options['fields']['webform_all_fields']['alter']['nl2br'] = TRUE;
$handler->display->display_options['fields']['webform_all_fields']['format'] = 'text';
/* Filter criterion: Content: Nid */
$handler->display->display_options['filters']['nid']['id'] = 'nid';
$handler->display->display_options['filters']['nid']['table'] = 'node';
$handler->display->display_options['filters']['nid']['field'] = 'nid';
$handler->display->display_options['filters']['nid']['value']['value'] = '5471';

Did I not follow your instructions correctly?

cobadger’s picture

@joelhsmith I'm not sure. I imported your view, updated the filter node id to match a webform node from our site and I'm seeing all of the fields in the preview.

biarr’s picture

The patch in #16 is working as expected. Thanks!

antonio.bertolini’s picture

Patch not working also in my case.
My scenario is:
view block with two contextual filter:
- per current user (When the filter value is NOT available => provide default value => User ID from logged in user)
- per current node (When the filter value is NOT available => provide default value => Content ID from URL)

Given a webform, I want to show submission filtered by current user but

_webform_view_find_id($view, $display_id, 'argument', array('field' => 'nid', 'table' => 'webform_submissions'));

return 0. so I change

      $webform_nid = (!empty($args[$arg_id])  && is_numeric($args[$arg_id]) && $args[$arg_id] > 0) ? $args[$arg_id] : NULL;
     }

to

      $webform_nid = (!empty($args[$arg_id])  && is_numeric($args[$arg_id]) && $args[$arg_id] > 0) ? $args[$arg_id] : NULL;
    } elseif (!empty($display->display_options['arguments']['nid']) && ($display->display_options['arguments']['nid']['default_argument_type'] == 'node')) {
	  // no args, but in the condition "provide default value => Content ID from URL" for a 'nid' argument.
   	  if(arg(0)=='node' && is_numeric(arg(1))){
	    $nid = arg(1);
	  }
	  $webform_nid = $nid;
	}

Saluti!

antonio.bertolini’s picture

liam morland’s picture

Version: 7.x-4.10 » 7.x-4.x-dev
Category: Support request » Bug report
julia.klimovsky’s picture

Just reroll patch without any modifications.

julia.klimovsky’s picture

liam morland’s picture

Status: Needs work » Needs review

liam morland’s picture

Status: Needs review » Needs work
liam morland’s picture

Status: Needs work » Needs review
liam morland’s picture

Status: Needs review » Needs work

Please fix the coding standards issues. Others who are having this problem, please review the patch.

julia.klimovsky’s picture

StatusFileSize
new8.4 KB

Rerolled against HEAD of 7.x-4.x.

Also fixed coding standards issues to address #29

julia.klimovsky’s picture

Status: Needs work » Needs review
drupal_josh’s picture

Patch #30 didn't work for me. Tried various combinations and individual contextual filters and relationships. Can't get any columns to show up in a views table.

Also tried making the changes from #20 but that didn't work either.

A simple guide would be immensely helpful.

drupal_josh’s picture

Ahh I got it. patch #30 did work in my case. Sorry.

I didn't use a contextual filter or a relationship. I used a regular filter for Content: nid and set it to the webform nid.

That's it. Webform submission data: All values should now show all the columns.

Didn't need to make it dynamic (it was a one off view for this form) so not sure how to get it working with a contextual filter. Maybe an exposed filter would work without additional mods.

For those who want to dig and debug the code some more. webform/views/webform.views.inc lines ~539 - 567 (after patching and at time of writing) is where it sets the variable $webform_nid. Have to make sure this gets set with a valid value.

dromansab’s picture

Hello,

Patch #30 doesn't work for me. I've tried with and without contextual filter and the view is not printing values.

liam morland’s picture

Status: Needs review » Closed (outdated)

Drupal 7 is no longer supported. If this applies to a supported version, please re-open.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.