diff -ru webform/components/date.inc webform-analysis-filter/components/date.inc
--- webform/components/date.inc	2008-10-08 21:51:44.000000000 +0200
+++ webform-analysis-filter/components/date.inc	2008-11-26 08:21:49.000000000 +0200
@@ -304,14 +304,16 @@
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_date($component) {
+function _webform_analysis_rows_date($component,$filter = NULL) {
   $query = 'SELECT no,data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND  cid = %d '.
+    ' AND  cid = %d %s'.
     ' ORDER BY sid,no ASC ';
-
-  $result = db_query($query, $component['nid'], $component['cid']);
+  if ($filter != NULL) {
+    $filter = " AND " . $filter;
+  }
+  $result = db_query($query, $component['nid'], $component['cid'],$filter);
   // build an array of timestamps from entered values.
   $timestamps = array();
   $submissions = 1;
diff -ru webform/components/email.inc webform-analysis-filter/components/email.inc
--- webform/components/email.inc	2008-10-06 07:45:41.000000000 +0200
+++ webform-analysis-filter/components/email.inc	2008-11-26 08:21:49.000000000 +0200
@@ -175,16 +175,19 @@
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_email($component) {
+function _webform_analysis_rows_email($component,$filter = NULL) {
   $query = 'SELECT data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND cid = %d';
+    ' AND cid = %d %s';
   $nonblanks = 0;
   $submissions = 0;
   $wordcount = 0;
+  if ($filter != NULL) {
+    $filter = " AND " . $filter;
+  }
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, $component['nid'], $component['cid'],$filter);
   while ($data = db_fetch_array($result)) {
     if ( strlen(trim($data['data'])) > 0 ) {
       $nonblanks++;
diff -ru webform/components/file.inc webform-analysis-filter/components/file.inc
--- webform/components/file.inc	2008-10-08 21:51:44.000000000 +0200
+++ webform-analysis-filter/components/file.inc	2008-11-26 08:21:49.000000000 +0200
@@ -454,16 +454,19 @@
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_file($component) {
+function _webform_analysis_rows_file($component,$filter = NULL) {
   $query = 'SELECT data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND cid = %d';
+    ' AND cid = %d %s';
   $nonblanks = 0;
   $submissions = 0;
   $wordcount = 0;
+  if ($filter != NULL) {
+    $filter = " AND " . $filter;
+  }
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, $component['nid'], $component['cid'],$filter);
   while ($data = db_fetch_array($result)) {
     $filedata = unserialize($data['data']);
     if ($filedata['filesize']) {
diff -ru webform/components/grid.inc webform-analysis-filter/components/grid.inc
--- webform/components/grid.inc	2008-10-08 21:51:44.000000000 +0200
+++ webform-analysis-filter/components/grid.inc	2008-11-26 08:25:51.000000000 +0200
@@ -221,7 +221,7 @@
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  **/
-function _webform_analysis_rows_grid($component) {
+function _webform_analysis_rows_grid($component,$filter = NULL) {
   // Generate the list of options and questions.
   $options = _webform_grid_options($component['extra']['options']);
   $questions = array_values(_webform_grid_options($component['extra']['questions']));
@@ -231,9 +231,13 @@
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
     ' AND cid = %d '.
-    " AND data != '0' AND data != '' ".
+    " AND data != '0' AND data != '' %s".
     ' GROUP BY no, data';
-  $result = db_query($query, $component['nid'], $component['cid']);
+  if ($filter != NULL) {
+    $filter = " AND " . $filter;
+  }
+
+  $result = db_query($query, $component['nid'], $component['cid'],$filter);
   $counts = array();
   while ($data = db_fetch_object($result)) {
     $counts[$data->no][$data->data] = $data->datacount;
diff -ru webform/components/hidden.inc webform-analysis-filter/components/hidden.inc
--- webform/components/hidden.inc	2008-09-06 22:51:36.000000000 +0200
+++ webform-analysis-filter/components/hidden.inc	2008-11-26 08:21:49.000000000 +0200
@@ -116,16 +116,19 @@
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_hidden($component) {
+function _webform_analysis_rows_hidden($component,$filter = NULL) {
   $query = 'SELECT data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND cid = %d';
+    ' AND cid = %d %s';
   $nonblanks = 0;
   $submissions = 0;
   $wordcount = 0;
+  if ($filter != NULL) {
+    $filter = " AND " . $filter;
+  }
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, $component['nid'], $component['cid'],$filter);
   while ($data = db_fetch_array($result)) {
     if ( strlen(trim($data['data'])) > 0 ) {
       $nonblanks++;
diff -ru webform/components/select.inc webform-analysis-filter/components/select.inc
--- webform/components/select.inc	2008-10-22 21:38:59.000000000 +0200
+++ webform-analysis-filter/components/select.inc	2008-11-26 08:24:06.000000000 +0200
@@ -283,16 +283,19 @@
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_select($component) {
+function _webform_analysis_rows_select($component,$filter = NULL) {
   $options = _webform_select_options($component['extra']['items']);
 
   $query = 'SELECT data, count(data) as datacount '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
     ' AND cid = %d '.
-    " AND data != '0' AND data != '' ".
+    " AND data != '0' AND data != '' %s".
     ' GROUP BY data ';
-  $result = db_query($query, $component['nid'], $component['cid']);
+  if ($filter != NULL) {
+    $filter = " AND " . $filter;
+  }
+  $result = db_query($query, $component['nid'], $component['cid'],$filter);
   $rows = array();
   while ($data = db_fetch_array($result)) {
     if ($options[$data['data']]) {
diff -ru webform/components/textarea.inc webform-analysis-filter/components/textarea.inc
--- webform/components/textarea.inc	2008-09-06 22:51:36.000000000 +0200
+++ webform-analysis-filter/components/textarea.inc	2008-11-26 08:21:49.000000000 +0200
@@ -137,16 +137,19 @@
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_textarea($component) {
+function _webform_analysis_rows_textarea($component,$filter = NULL) {
   $query = 'SELECT data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND cid = %d';
+    ' AND cid = %d %s';
   $nonblanks = 0;
   $submissions = 0;
   $wordcount = 0;
+  if ($filter != NULL) {
+    $filter = " AND " . $filter;
+  }
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, $component['nid'], $component['cid'],$filter);
   while ($data = db_fetch_array($result)) {
     if ( strlen(trim($data['data'])) > 0 ) {
       $nonblanks++;
diff -ru webform/components/textfield.inc webform-analysis-filter/components/textfield.inc
--- webform/components/textfield.inc	2008-10-14 20:20:02.000000000 +0200
+++ webform-analysis-filter/components/textfield.inc	2008-11-26 08:21:49.000000000 +0200
@@ -182,16 +182,19 @@
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_textfield($component) {
+function _webform_analysis_rows_textfield($component,$filter = NULL) {
   $query = 'SELECT data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    '  AND cid = %d';
+    '  AND cid = %d %s';
   $nonblanks = 0;
   $submissions = 0;
   $wordcount = 0;
+  if ($filter != NULL) {
+    $filter = " AND " . $filter;
+  }
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, $component['nid'], $component['cid'],$filter);
   while ($data = db_fetch_array($result)) {
     if ( strlen(trim($data['data'])) > 0 ) {
       $nonblanks++;
diff -ru webform/components/time.inc webform-analysis-filter/components/time.inc
--- webform/components/time.inc	2008-10-08 21:51:44.000000000 +0200
+++ webform-analysis-filter/components/time.inc	2008-11-26 08:21:49.000000000 +0200
@@ -255,14 +255,17 @@
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_time($component) {
+function _webform_analysis_rows_time($component,$filter = NULL) {
   $query = 'SELECT no,data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND  cid = %d '.
+    ' AND  cid = %d %s '.
     ' ORDER BY sid,no ASC ';
+  if ($filter != NULL) {
+    $filter = " AND " . $filter;
+  }
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, $component['nid'], $component['cid'],$filter);
   // build an array of timestamps from entered values.
   $timestamps = array();
   $submissions = 1;
diff -ru webform/webform_report.inc webform-analysis-filter/webform_report.inc
--- webform/webform_report.inc	2008-10-08 21:51:44.000000000 +0200
+++ webform-analysis-filter/webform_report.inc	2008-11-26 08:37:17.000000000 +0200
@@ -374,7 +374,7 @@
 /**
  * Provides a simple analysis of all submissions to a webform.
  */
-function webform_results_analysis($node) {
+function webform_results_analysis($node,$filter = NULL) {
   $rows = array();
   $question_number = 0;
 
@@ -390,7 +390,7 @@
     // Do component specific call.
     $analysis_function = "_webform_analysis_rows_". $component['type'];
     if (function_exists($analysis_function)) {
-      $crows = $analysis_function($component);
+      $crows = $analysis_function($component,$filter);
       if (is_array($crows)) {
         $row[0] = array('data' => '<strong>'. $question_number .'</strong>', 'rowspan' => count($crows) + 1, 'valign' => 'top');
         $row[1] = array('data' => '<strong>'. $component['name'] .'</strong>', 'colspan' => '10');
