Hi,
I have faced lots of problems with implementing Webforms submission with Views on Drupal7 and finally after working alot for the same i have found the solutions.
I want to share this solution with others may be this can be useful for some beginners.
Requirement is I have to Display the Submitted data for the Webform and data should be sorted from header and there should be edit link through which user can edit the corresponding submission.

Here is the steps:

Here is the steps to display and create view for the display of Submitted Data of Webform:

1. Install Webform Mysql Views module.

2. For Webform Mysql Views you need to install Data and Schema module.

3. After installations of above mentioned modules go to the
=> "content" menu
=> "webforms" tab
=> "Mysql Views" tab

4. Then you find a table which contains "Webform Name" and "View Name" for the webform nodes

5. Select the "Webform Name" for which you want to create view or display.

6. When you submit the form after selection, a table is created for the specific Webform Name which you have selected.

7. Suppose if you have selected 2 "Webform Name" 2 different tables for the webform submitted data is created, which contains the complete submissions for that particular webform node.

8. Then go to the "Structure" menu:
=> Select "Data tables" which is created from data module.
=> There you find 3 tabs:
a.) check if table name for the webform is available in "Overview" tab or not.
b.) open "Adopt tables" where you find "Orphaned Tables" listing.
c.) select the webform table for which you want to create display.
d.) Then press adopt submit button.
e.) after submission of form a table is display in "Overview" tab.
=> Then you have display the listing for the table you have selected above and operations for the same displays.
=> Click on "Edit" link, you are opened with "Edit Schema" for that table.
=> Now you get the listing of all the fields you have added in the webform.
=> There is "Primary Key" check box if you checked the box you get an error for base_field etc, so don't add the primary key.
=> But you have to add Joins for the same, you can add joins for multiple field.
=> Ex. you have first field sid and you want to add join for the same click "joins":
a.) Now you are opened with Join field which contains select box for the tables and there corresponding fields.
b.) Select the field Ex: - for sid from webform_submissions table sid.
c.) Add left join.
d.) Submit the form.
e.) Now you are joined with the webform_submissions table.
=> Then submit the form click on "Save".

9. Now create a new view for the webform:
=> Select type as "Webform submissions" and format is table.
=> Now by default you get (Submission Data) Ex: - (Submission Data) Webform views contact us 8: Sid (Sid).
=> Add Relationship for the view on Ex: - "Webform views contact us 8: Sid" from the available webform views name.
=> After adding Relationship you are available with the "Submission Data" for the corresponding Webform, you can add any field from that what ever is required.
=> To add edit link you can use default webform edit link field, which is used to edit the submission data for the corresponding submissions .
=> Add path whatever you required.
=> Finally save the view.

10. Now you are Available with the complete table with Headers, Submission data and edit operation.

11. For Sorting Through Headers:
=> Click Format Table Settings.
=> Check Sortable and add Default order.

12. Finally you get the Display for the Webform Submitted data with Sorting through Headers and Edit functionality.

Comments

avanish12’s picture

Good Job Wattan this is very useful for me.
Be continue ...

shankarpmenon’s picture

That was great and very helpful,
one doubt how do we show images when uploaded from webform.
though i tried but could not get. currently it is showing the file name ( a numeric no)

regards

SimpleDivya’s picture

Do You find any solution related to your problem.
I am not getting the images which is uploaded by webform.
In views its showing the file no(Numeric value).
Please help me . and suggest.

Thanks in advance.

shankarpmenon’s picture

hi,
not yet.
so what i did was use profile2 and make the registration for different profile
then created views. relate user details and profile 2 details
it worked. This i read some where i dont remember. but thanks to them

regards

squarecandy’s picture

I did get images displaying through this somewhat lengthy process:

  1. Go to /admin/structure/data/edit/webform_mywebform (Structure > Data Tables. click Edit on your view)
  2. Find your image field, click the link under JOINS
  3. select file_managed.fid and left join. Save it.
  4. clear the cache
  5. go to your view. Under Relationships, you should alread have Content: Webform submission. Add (Webform Submission) Webform views my view: Photo.
  6. Under fields add (webform_views_my_view.photo -> file_managed.fid) File: Path. Now you should see the file uri showing in the view
  7. Copy views-view-field.tpl.php from the views module to your theme. Duplicate and use the Theme Information link in views to find the right file name to override the new uri field you created. Something like views-view-field--my-view-name--uri.tpl.php
  8. Insert this code:
      $var = array(
        'style_name'=>'thumbnail',
        'path'=>$output
      );
      print theme_image_style($var);
    

    you can replace "thumbnail" with any image style you have created. See the docs for more on theme_image_style.

Hope that helps someone!

sudanshu.singh’s picture

you save my lot of time.
good work, keep it up....

pixelupper’s picture

Wow THANK YOU!!! This has saved my week. Been fighting with the same modules.

4kant’s picture

Thanks - I did it... Thanks!

ragnarkurm’s picture

Saved a lot of time.

ragnarkurm’s picture

Got error

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name 'webform_views_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx': CREATE OR REPLACE VIEW ...

Root cause: too long webform title.

Discovered that the database view was not created.
Though MySQL Views insisted that is there.
Could not remove MySQL Views entry either.

To fix the situation:

  1. drush vget webform_mysql_views_views
  2. based on the results, reconstruct data structure by deleting invalid entry.

    drush php-eval '<?php
    variable_set("webform_mysql_views_views", array(...));
    ?>'
  3. Change original webform title to something shorter (temporarily)
  4. Now go to MySQL Views: Webforms and create the view
  5. If necessary restore original webform title
directory1182’s picture

This solved the issue for me. Thank you very much!

jouflas’s picture

I've done everything and was looking forward to a "beautiful view" but I continually get:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'webform_views_roll_call_3': DROP VIEW {webform_views_roll_call_3}; Array ( ) in webform_mysql_views_admin_form_submit() (line 268 of /Applications/MAMP/htdocs/drupal/sites/all/modules/webform_mysql_views/webform_mysql_views.module).

It looks like I have an orphaned view. I can't even uninstall Webform MySQL Views without hitting this error.

I've deleted .... cleared caches.... reinstalled.... nothing

Any suggestions?

Barto.G’s picture

Hello Jouflas,

I have the exat same error. Have you found the solution by any chance ?

jojojibba’s picture

=> There is "Primary Key" check box if you checked the box you get an error for base_field etc, so don't add the primary key.
=> But you have to add Joins for the same, you can add joins for multiple field.
=> Ex. you have first field sid and you want to add join for the same click "joins":
a.) Now you are opened with Join field which contains select box for the tables and there corresponding fields.
b.) Select the field Ex: - for sid from webform_submissions table sid.
c.) Add left join.
d.) Submit the form.
e.) Now you are joined with the webform_submissions table.
=> Then submit the form click on "Save".

I see the list in 'EDIT SCHEMA' but i'm not following what to do with the 'JOINS' part..

Examples of what I would like to see in the table view from the NAMES column on the EDIT SCHEMA tab: first_name, last_name, title, date

I do not know what to assign for the JOINS
you lost me...
Can someone help me with some specifics, p p please?

drupaluser2012’s picture

Hi,

I have created the view but not able to add relationship.

=> Add Relationship for the view on Ex: - "Webform views contact us 8: Sid" from the available webform views name.

Please help me...

taote’s picture

Hiraman, I had a similar problem, I couldn't add the relationship because they were not present in the relationship list in the view. This was solved refreshing the cache, after adding the joins.

There is also a video explaining the whole process (except the cleaning cache issue): Display Webform submission data in Views.

I have found several problems trying to achieve this, one of them was that Data/Views module integration does not work if your Drupal database is configured to use a table prefix, so after importing orphan tables, they were not included in the list. So what I did was to remove the prefix from the database tables, executing the php code found here in a php block.

Rik Gadsby’s picture

this explanation is really good and works but i have a problem displaying table data from a webform. the data contains code, eg:

table with three rows should read:

1 One day at each of 6 (6 days @ £300/day) 1800.00
2 Two days at 1 @ £300/day 600.00
3 Exhibition Venue and set up costs 100.00

but looks like this:

Breakdown desc: a:4:{i:1;s:94:"One day at each of 6 (6 days @ £300/day)";i:2;s:103:"Two days at 1 @ £300/day";i:3;s:33:"Exhibition Venue and set up costs";i:4;N;}
Cost: a:4:{i:1;s:7:"1800.00";i:2;s:8:" 600.00";i:3;s:8:" 100.00";i:4;N;}

anyone got any ideas on displaying table data?

many thanks

elblufer’s picture

There is now a 7.x-4.x branch of webform that works with views without installing any additional modules. It might be worth checking out if that works for you. NOTE: You cannot revert to the previous version after you upload, so I highly suggest making a database dump.

Khetam’s picture

Great
Thanks alot.
This is very useful for me, but there is small issue.
I have webform with two components the first one is Title and it textfield without validation, the second one is also textfield with url validation, when i created the view its get the right data but the url is not completed it always get the url column with 340 char only and trim the rest.

bmango’s picture

Thanks very much for taking the time to write this up. It really helped and saved me a lot of time. :)

loopy1492’s picture

This video worked for me.

rameshbalda’s picture

hi this work great for me , but the prob is if admin want to view form submission details of the user means.how can i provide that link.
for example in view they multiple user if admin click on paticular user link i want to show his form submission filled details

mixael’s picture

Hello!
Webform 7.x-4.0-alpha9

I've tried Webform MySQL Views. But it has extremely low performance because data are not indexed in the generated table. Filtering or sorting takes some minutes! I spent a lot of time to find solution to fix it but nothing had found.
I've chosen another way...
Now adding fields to view I'm using standard "Webform submission data: Value". For filtering or sorting it is need to make relation to webform submission data choosing component. All works very fast.

linuxor’s picture

Could you explain a bit more how you did this? I couldn't understand how you did!

Thanks in advanced!

rinkiprasad’s picture

Thanks dear. This post save my lot's of time. Good posting.............

linuxor’s picture

I see that webform under the "ADOPT TABLES" but when I choose it and click on Adopt, i get the following message:
"Field main_webform_views_hitta_partner_anskan_1328.submitted: no Schema type for mysql type datetime."

Does any one know how to solve this problem?

Thanks in advanced!

rwilson0429’s picture

@linuxor, do you have prefixes on your MySQL table names? If so, remove the table prefixes and modify your settings.php and set 'prefix' => '' in the $databases array settings. Also, flush your caches.

There is a php script and directions here to remove the table prefixes.

ReggieW

leolandotan’s picture

prefix is set to '' by default but I'm still getting an error and now I also cant drop the table. Any ideas?

peterlangela’s picture

Great time saving post, thank you!

I encountered that for some Webforms under
=> "content" menu
=> "webforms" tab
=> "Mysql Views" tab
some of the forms where already selected while no SQL vieww were created. Due to this it was not possible to de-select the forms (error encountered).

What i did to solve this:
- go to phpMyAdmin and find the proper database (and make a backup to be save)
- goto to the table "variable"
- find the 2 rows:
webform_mysql_views_meets_reqs
webform_mysql_views_views
- remove (SQL) views like "webform_views_*" that are not in use or checked
- clear the cache

Now it worked for me. I hope it helps others with the same problem.

Tajdar Khan Afridi’s picture

Really good! works for me.

harishrachuri’s picture

Thankx alot for the info.
I need to display file uploads form webform to views page.

sagigreen’s picture

i get the following error while trying to adopt table:

User warning: webform_views_testemonial.submitted: no schema type for mysql type datetime. in schema_schema_type() (line 384 of /home2/sagigree/public_html/sites/all/modules/schema/schema.module).

any help will be appriciated

Sagi Green
VP Biz Dev
Crazy Designs
info@crazydesigns.biz
www.crazydesigns.biz

azizachom’s picture

I got the same error

nicholasThompson’s picture

Webform 4 supports this natively, but for those still using Webform 3 - https://drupal.org/node/1219954#comment-8589477

The zip in #16 work well for me (at the time of writing).

shahidbscs’s picture

Awesome post, working great for me.

Just one thing, need to display "file Field" in views page. Thank you so much.

bolshii’s picture

Amazing. You did a great job. Of course the extension builder as well ;)

imadeitup’s picture

I having trouble following what you're saying here. Some clarification would be greatly appreciated.

=> Select type as "Webform submissions" and format is table.

This made sense. No problem.

=> Now by default you get (Submission Data) Ex: - (Submission Data) Webform views contact us 8: Sid (Sid).

This is where I got lost. Where do I "get" this? Where does "(Submission Data)" appear?

=> Add Relationship for the view on Ex: - "Webform views contact us 8: Sid" from the available webform views name.

Totally lost on what this is trying to say.

When I click "Add Relationship" I get the following options. Which do I choose?
Content: Author
Content: Taxonomy terms on node
Content: Webform submission
Entity Reference: Referencing entity
Webform submissions: Node
Webform submissions: User

imadeitup’s picture

Never mind. It was confusion with the Joins like jojojibba said before. Here's what I did:

In the "Edit Schema" screen that lists all of the fields, I clicked "none" for sid (the last column of the first line)
On the following page, I selected "webform_submitted_data.sid" and "Left Join" and Saved it
Now, back at the Views page...
First, make sure that in Fields, the "sid" field is removed. It wasn't added properly by default.
Under Relationships, I clicked "Add" and selected "Webform views [MY FORM NAME]: Sid" and clicked the Add button
NOW, under Fields, I have all of the fields from the webform available

James Hawthorn-Byng’s picture

Hi,
I am building a website that allows users to setup their own webforms.
Does anyone know how to apply this process so one view can display the submission data for any webform?
I dont really want to do this each time someone adds a new form.

kimhim’s picture

Dear,

When I create a new view, I don't see webform submission to select. What is the problem. could you guide me.
Thank for you help.

umeshpatil’s picture

Well, this is very long process. But if you are running latest Views and Webform module on Drupal 7 you can do it in just 4 to 5 steps and that too very easily without even installing any extra module.
Just create a new view by selecting webform submissions data and rendered submissions instead of fields under Display format.
Or follow the process from this : - how-display-webform-submissions-views-drupal-7

raghwendra’s picture

Thanks to you to post such detail creation of views for webform submission. I tried it and working for me but in join my webform submission column value is multiple and it is 1,2,3 and can't be related it with each taxonomy term tid coz join will be work with one to one value relation with exact match ? if i am wrong can any one please suggest the solution for this.

ravindra1993’s picture

Error messagePDOException: SQLSTATE[HY000]: General error: 1347 'dbdemo.webform_views_feedback' is not BASE TABLE: ALTER TABLE {webform_views_feedback} CHANGE `submitted` `submitted` INT NULL DEFAULT NULL; Array ( ) in db_change_field() (line 3020 of D:\xampp\htdocs\DBDemo\includes\database\database.inc).

The website encountered an unexpected error. Please try again later.

I got that error. It wont help me. Any suggestion would be appriciated.

dj.sison’s picture

However, when I add a webform field (where field type = select options), the result on the views table displays the safe_key (1, 2, 3, etc.) instead of the human readable option. How can I rewrite the results to display the readable value as opposed to the machine key?

emily4247’s picture

I am scouring the web looking for the answer to your exact question. Did you ever figure it out?