0

I am able to get the webform submission count total for single webforms, but when I filter for multiple webforms (using the OR operator) it only shows the total count for 1 of the webforms. How can I have Views add the counts for all of the webforms I filter?

2
  • What version of the Webform module are you using? Drupal 7 or 8.
    – jrockowitz
    Commented Apr 12, 2018 at 14:43
  • I am using Webform Version: 7.x-4.16. I did figure out a solution - although not using Views. Will answer my own question shortly.
    – penone
    Commented Apr 12, 2018 at 14:52

1 Answer 1

0

I found a solution to my problem - albeit not using Views - to accomplish what I wanted to do.

My goal was to have a counter on a page where it showed how many submissions for certain forms have been submitted. I needed to show a combined total of 2 or more webforms but could not accomplish this with Views.

I did find this code that led me to my solution:

First, need to include webform_submissions:

module_load_include('inc', 'webform', 'includes/webform.submissions');

Then added this line:

webform_get_submission_count($nid, $uid = NULL)

I took out the $uid as I did not need to filter by user and made multiple calls for the different webforms I needed:

$a = webform_get_submission_count($node->nid = '6');
$b = webform_get_submission_count($node->nid = '7');

I then put the following line to add the 2 variables to get me the total that I can then use on my page:

$c = $a + $b;

This solutions was actually better for me because with Views I could never get the No Results Behavior to show 0 when there were no submissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.