# SQL Operations

## Activating Export to SQL

Using eForm Export to SQL is pretty straight forward. Once you are done installing, simply create a new form and edit an existing one. All export related settings are there inside the form builder.

### #1:Activating Export to SQL on a form:

- Edit or create a new form.
- Under the form builder you will see a new tab named SQL Export.
- Click on the tab and enable the option Enable Direct SQL Export.
- Save the form and reload. Under the same tab it will show you the table name in which it will save the data.

### #2: Configuring Export options:

As of version 1.0.0 you can not change the table name. We have made the system in this way to prevent accidental data overriding. But there are other options which you can change.

- Drop Deleted Element Columns: Once the form is saved, the system will check for deleted elements and will also drop the corresponding columns on the SQL table. If you want to retain columns of deleted elements then you can disable this option.
- Exclude List: Comma Separated short notations of fields to exclude from export. Like
  `m0`: MCQ 0
  `f10`:Freetype 10
  `o12`: Other 12.
  To include them all `m0,f10,o12`.
- Limit Total Number of Exports: If you want to limit the total number of exports for the table, then please mention it here. It should be a numeric greater than 0. For example, if you mention 50, then a total of 50 exports will be saved in the table. When new exports are made, older would be deleted.
- Limit for last n days: You can limit the exports for last n days. If you enter here `30`, then exports from last 30 days would be saved. When new exports are made, only then expired/older exports would be deleted. If you want the system to force check, then please perform Check Missing Submission operation.
- Multiple Options Delimiter: Enter the Multiple Option Delimiter (For questions like Multiple Options, Matrix etc). Default is `::`
- Field Range Delimiter: Enter the Range Delimiter (For questions like Grading, Ranges etc). Default is `/`
- Multiple Row Delimiter: Enter the Multiple Row Delimiter (For questions like Grading, Spinners, Matrix etc). Default is `~`

That’s all about activation. In the next tutorial learn about some basic and advanced SQL operations you can perform from inside the system.

## Check for missing or expired records

While most of the process is automatic with FSQM Export to SQL addon, yet some de-synchronization may occur between export table and FSQM table. This may be due to the following reasons:

- Submissions prior to the setup of SQL Exports are not automatically saved to the table.
- Expired records (especially for last n days) get deleted only when a new submission is made.

To overcome such abnormality, we have provided an easy to use tool which would check for data consistency automatically and would import or delete records if needed.

### #1: Using the tool:

1. Go to WP Admin > eForm > Form Auto Exports.
2. Select the form and click on Synchronize Submissions.
3. Let the system run through its process.
4. Once done, it will automatically import and/or delete irrelevant records.

## Browsing Exports and Performing some SQL Operations

Our system has an built in tool using which you can browse the export table directly and perform some SQL operations. To do so, please follow the procedure below:

### #1: Browsing SQL Records:

- Go to WP Admin > eForm > Form Auto Export.
- Select the table and Click on View Exports.
- Now you will be given a table from where you can browse the records.
- Optionally you can copy paste the query and/or perform following operations.

### #2: Searching through Export Records:

- Type something in the Search box and click on Search Submissions.
- It will search all available columns and will present all relevant records.

### #3: Deleting Export Records:

- Hover on a record and click delete. This will delete the record from the export table only.
- Check more than one records and choose Delete from Bulk actions. Then click on the apply button. This will bulk delete records from the export table.

Do note that, currently the system would not delete records from the export table even if it is deleted from FSQM table. If you want to, then you’d need to manually delete them.

## Downloading entries in XLSX file

eForm Export to SQL has a built-in tool to export records to a XLSX spreadsheet file. Doing so is easy and requires just a few clicks.

### #1: Exporting to XLSX File:

- Go to WP Admin > eForm > Form Auto Exports.
- Select the form, and click on Download Export (XLSX) button.
- This will give you a xlsx file which you can open using software like MS Excel.

### #2: Troubleshooting:

- If downloading XLSX fails, then it probably means PHP is running out of memory. Please try to increase it using this procedure.
- Using the same method, you might try to increase `max_execution_time` directive.
- If everything fails, feel free to ask in our support forum.

## Revision Control of submission edit

Starting version 1.2.0, Easy SQL provides a way to have revision control for user driven submission edits. To enable, simply follow the steps.

- Edit a form and click on SQL Export.
- Enable the option “Keep Old Submission on update (Revision Control)”.
- Save the form and you are good to go.

Now when user edits and updates a form the previous entry will be kept in the database.

You can use the admin backend to view the revisions side-by-side.

You can also get the revisions in the downloadable XLSX file.

### Get more with eForm through our collection of Addons

#### Love eForm? Checkout our addons

Checkout our collection of eForm Addons designed to help you get more. You can take reports offline, award users with myCRED points and do more with direct export to a dedicated mySQL table. More to come soon.

iPanelThemes Web Solutions Pvt. Ltd.