Overview
Introduction
The data entry feature writes page data to a database, including adding, deleting, and modifying data. It also supports custom validation, importing data from Excel, and smart linkage based on entered values. This document uses a simple row-based data entry report to explain how to create a data entry report in FineReport Designer.
Expected Result
1. Add data:
In data entry preview, select a row and click Add Record to add a row after the selected row.

2. Modify data:
In data entry preview, select a row and modify the values in its data columns.

3. Delete data:
In data entry preview, select a row and click Delete Record to delete the selected row.

Steps
Preparing Data
Create a dataset named ds1. In the Database Query dialog box, enter the following SQL statement: SELECT * FROM SProduct ORDER BY ProductID LIMIT 5. This retrieves the first five records from the SProduct table, sorted by ProductID in ascending order.

Designing the Report
1. Enter the following column headers in cells A1–I1 in order: Product ID, Product Name, Supplier ID, Category ID, Quantity Per Unit, Unit Price, Units in Stock, Units on Order, and Reorder Level. Drag the corresponding dataset columns into cells A2–I2 in the same order.

2. Click the theme button
. In the pop-up Template Theme window, select Compatible Theme. Select cells A1–I1, then go to Cell Attribute > Style, set Style Setting to Theme, and select the Header style. Center-align the table body text and apply light blue inner and outer borders.

Adding Data Entry Widgets
Add widgets to cells for entering data. Data cannot be entered without these widgets. Choose a widget type that suits your application. This document uses text widgets as an example.
Select cells A2–I2. In the properties panel on the right, click Widget Setting and choose Text Widget from the Select Widget drop-down list box.

This example uses both data columns and data entry widgets to display existing data and allow you to add or modify records. For other scenarios, you can configure them differently:
To enter and submit new data without displaying existing dataset data, add data entry widgets directly to blank cells. You do not need to drag data columns into cells A2–I2.
To submit existing dataset data without allowing users to add or modify records, drag the data columns into the corresponding cells. You do not need to add data entry widgets.
Setting Data Entry Attributes
Data entry attributes map cells containing input data to database table fields, determining the table and field to which each cell value is written.
1. Choose Template > Data Entry Attribute from the menu bar to open the Data Entry Attribute dialog box.
2. In the dialog box, click Submit, click
, and select Built-in SQL as the data submission method. Set the submission type to Smart Submission, the database to FRDemo, and the table to SProduct.

3. Click Smart Add Field to specify the fields available for data entry, and then click Smart Add Cell to bind cells to database table columns. Select ProductID as the primary key. For details, see Built-in SQL Submission. Select No Modification, No Update, and click OK to finish configuring the report data entry attributes.

Note:1. When No Modification, No Update is selected, unmodified data is excluded from submission during data entry. For details, see No Modification, No Update.
2. To modify or delete existing records, you must select one or more fields as primary keys. These fields are used to identify the records to update or delete, similar to the conditions in a SQL WHERE clause. They do not have to be primary keys defined in the database.
Setting Template Web Attributes
Template web attributes customize the data entry preview page, including the toolbar, report position, and tab position.
Note:Configuring template web attributes is optional when creating a data entry template. You can use the default web attribute settings.
1. Choose Template > Web Attribute from the menu bar to open the template web attributes dialog box.
2. In the dialog box, click Data Entry Setting and choose Set Following Settings: to Set for This Template Separately to configure the web attributes of the data entry page. Select Set Background When Filling Current Edit Row: and set the background color to green. Click the
button to remove the default top toolbar. Double-click widgets in the tool library below to add them to the top toolbar. In this example, add four custom widgets: Submit, Data Validation, Add Record, and Delete Record. Keep the default settings for the remaining options and click OK to finish configuring the data entry preview page.

Previewing the Effect
PC
1. Click Save to save the report. Click Data Entry Preview to preview the report, as shown in the following figure.

2. Add data:

3. Modify data:

4. Delete data:

Mobile Device
For instructions on viewing reports on mobile devices, see Quick Single Template Preview Through DataAnalyst.
The data entry toolbar is not displayed in mobile preview. Therefore, in mobile data entry preview, this sample report supports modifying data only; adding and deleting data are unavailable. To enable adding and deleting data on mobile devices, add custom buttons for inserting and deleting rows when designing the report. For configuration instructions, see Row Insertion and Deletion.

Completed Template
Download the template: Row-based Data Entry.cpt