Overview
Introducing Data Entry
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.
Reviewing Expected Results
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 rows/columns" to delete the selected row.
Steps
Preparing Data
Create a dataset named ds1. In the database query dialog box, enter the SQL query SELECT * FROM S产品 ORDER BY 产品ID LIMIT 5 to retrieve the first five records from the S产品 table, sorted by 产品ID.
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. Select "Compatibility theme" as the template theme. Select cells A1–I1 and set the header style to "Head1" under "Cell attributes > Follow theme" on the right. Center-align the table body text and add sky-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, select "Widget settings" and choose "Text widget" from the widget drop-down list.
Configure the widgets according to your application:
To submit only custom data to the database, add data entry widgets directly to blank cells without dragging data columns into A2–I2.
To submit dataset records to the database without modifying or adding data, drag the data columns into cells without adding 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 > Report data entry attributes" from the menu bar to open the "Report data entry attributes" dialog box.
2. In the dialog box, select "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 "S产品".
3. Select "Smart add fields" to specify the fields available for data entry, then select "Smart add cells" to bind cells to database table columns. Select "产品ID" as the "Primary key". For details, see Built-in SQL submission. Select "Do not update unmodified data" and click "OK" to finish configuring the report data entry attributes.
Note:When "Do not update unmodified data" is selected, unmodified page data is excluded from submission during data entry. For details, see Skipping unmodified data during data entry.
If you need to modify or delete data, select one or more primary keys. These keys serve the same purpose as the WHERE clause in SQL and are different from database primary keys.
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 > Template web attributes" from the menu bar to open the template web attributes dialog box.
2. In the template web attributes dialog box, select "Data entry page settings" and choose "Set separately for this template" to configure the web attributes of the data entry page. Select "Background settings for the current editing row during data entry" 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", "Insert record", and "Delete record". Keep the default settings for the remaining options and click "OK" to finish configuring the data entry preview page.
Previewing Results
PC
1. Click "Save" to save the report. Select "Data entry preview" to view the report, as shown in the following figure:
2. Add data:
3. Modify data:
4. Delete data:
Mobile Devices
For instructions on viewing reports on mobile devices, see Previewing reports on mobile devices.
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 an "Insert/delete rows" button when designing the report. For configuration instructions, see the document: Inserting and deleting rows.
Completed Template
Download the template: