Sitecore WFFM: Customizing Form Reports > Export to Excel – Part 1/2

Posted on Updated on

Recently, I had a simple task.

Test the “Form Reports” and see if it is working properly, do also check the data in the excel & xml files if correct after exported.

Fast forward. I exported it to CSV then I noticed something irrelevant. The ‘Date of Birth’ field uses an ISO date format (what a surprised!?).

form reports exported in CSV.JPG

I did a thorough checking in the WFFM configurations and its settings for the export, but it seems that there was no option to change it to a different date format.

So quickly, I jumped to SQL to understand how it is being inserted.

Using the select query, I was able to had a quick look on the values inserted in the FormFieldValues table/

SELECT * FROM [dbo].[FormFieldValues]

FormFieldValues table result.JPG

Knowing that when using the form designer, content authors have the ability to add/remove fields whenever he/she wanted to.

Important note: Sitecore stores the data in a vertical fashion. In other words, the FieldValue field uses NVARCHAR to accommodate any type of value regardless if this is a date (regardless of any format), a checkbox (true/false) and the rest.

And now we know the problem, how do we resolve this?

First and the easiest route is to query the word ‘ExportToExcel’ in Core database.

query of exportoexcel worl.JPG

Then I navigated to the item itself.

Item Id: E8047E7B-13EF-420F-8A89-5FC01BABEBF4

Item Path: /sitecore/client/Applications/WFFM/Resources/Parameters/ActionControl Parameters/ActionColumn/ActionGroup/ExportToExcel

Scrolling down to the bottom part, in “Action” section > click field, I noticed this value:

javascript:app.exportToExcel()

I search again for the ‘exportToExcel’ keyword, but this time in the files system. I hit the correct .js and .config files.

Physical path: \8.0-U3\Website\sitecore\shell\client\Applications\WFFM\Pages\FormReport\FormReport.js

exporttoExcel method- FormReport js

DLL: Sitecore.WFM.Services.dll

Method: Sitecore.WFFM.Services.Pipelines.ExportToExcel.ExportFormDataToExcel,

exportToExcel config settings.JPG

Raw value:

<!--

Purpose: This include file configures Web Forms for Marketers. The file is mandatory for Web Forms for Marketers to function correctly.

-->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:x="http://www.sitecore.net/xmlconfig/">
<sitecore>
<!-- PIPELINES -->
<pipelines>
<!-- EXPORT TO XML -->
<exportToXml>
<processor type="Sitecore.WFFM.Services.Pipelines.ExportToXml.ExportFormDataToXml, Sitecore.WFFM.Services" />
<processor type="Sitecore.WFFM.Services.Pipelines.SaveContent, Sitecore.WFFM.Services" />
</exportToXml>
<!-- EXPORT TO EXCEL -->
<exportToExcel>
<processor type="Sitecore.WFFM.Services.Pipelines.ExportToExcel.ExportFormDataToExcel, Sitecore.WFFM.Services" />
<processor type="Sitecore.WFFM.Services.Pipelines.SaveContent, Sitecore.WFFM.Services" />
</exportToExcel>
<exportToAscx>
<processor type="Sitecore.WFFM.Services.Pipelines.SaveContent, Sitecore.WFFM.Services" />
</exportToAscx>
</pipelines>
<!-- Commands -->
<commands>
<command name="forms:export:completed" type="Sitecore.WFFM.Services.Pipelines.ExportCompleted,Sitecore.WFFM.Services" />
</commands>
<!-- CONTROLLERS -->
<controllers>
<controller type="Sitecore.WFFM.Services.Requests.Controllers.FormReportsController,Sitecore.WFFM.Services">
<param name="formsDataProvider" ref="wffm/formsDataProvider"/>
</controller>
<controller type="Sitecore.WFFM.Services.Requests.Controllers.ExportFormDataController,Sitecore.WFFM.Services">
<param name="formsDataProvider" ref="wffm/formsDataProvider"/>
</controller>
</controllers>
</sitecore>
</configuration>

 

disasemble all the things.jpg

 

See part 2 “Disassembling the ExportFormDataToExcelhere.

Advertisements

One thought on “Sitecore WFFM: Customizing Form Reports > Export to Excel – Part 1/2

    […] If you’re interested to check the background of the customization. See part 1 of “Disassembling the ExportFormDataToExcel” here. […]

    Like

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