How to delete the Sitecore WFFM Form Summary Report

Posted on Updated on

So today, I wanted to delete all my test form summary reports.

I remember that during the WFFM installation, there was a post installation step, a prerequisite, before to start working with the WFFM.

Execute the WFFM_Analytics.sql

The script can be found in the \Website\Data folder. And when you open the .sql on your favorite editor. You’ll notice that it creates four (4) tables named:

  1. [dbo].[Fact_FormSummary]
  2. [dbo].[Fact_FormEvents]
  3. [dbo].[Fact_FormStatisticsByContact]
  4. [dbo].[FormFieldValues]

The submission of the data from a form will be inserted to these fields. So basically, if you want to delete the record, just run the sql scripts below in your SQL server:

-- DROP CONSTRAINT
ALTER TABLE [dbo].[Fact_FormSummary] DROP CONSTRAINT "FK_FormSummary_FieldValueId"

-- TRUNCATE TABLE 
TRUNCATE TABLE [dbo].[FormFieldValues]
TRUNCATE TABLE [dbo].[Fact_FormSummary]
TRUNCATE TABLE [dbo].[Fact_FormStatisticsByContact]
TRUNCATE TABLE [dbo].[Fact_FormEvents]

-- RECREATE CONSTRAINT
ALTER TABLE [dbo].[Fact_FormSummary]
ADD CONSTRAINT [FK_FormSummary_FieldValueId] FOREIGN KEY ([FieldValueId]) REFERENCES [dbo].[FormFieldValues] ([FieldValueId])

Sitecore WFFM - Empty Form Summary report

 

Alternatively, if you want to completely erase the forms table then you can try this:

-- DROP CONSTRAINT
ALTER TABLE [dbo].[Fact_FormSummary] DROP CONSTRAINT "FK_FormSummary_FieldValueId"

-- DROP TABLE 
DROP TABLE [dbo].[FormFieldValues]
DROP TABLE [dbo].[Fact_FormSummary]
DROP TABLE [dbo].[Fact_FormStatisticsByContact]
DROP TABLE [dbo].[Fact_FormEvents]
DROP PROCEDURE Add_FormStatisticsByContact

 

Download the .sql file here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s