Overview
Application Scenario
When you need to import an Excel file to a template and submit the file data to a database on the template preview page, a large data volume can significantly burden the browser, possibly causing page crashes.
The Excel Batch Import plugin allows you to import multiple Excel files to a template and submit the data of files to a database without previewing the template, making it suitable for the scenario where there is no requirement to modify data on the preview page.
Function Description
1. Importing Excel files and submitting data of files to the database coincide, without the need to preview the template.
2. The entry of the Batch Import function is set on the decision-making platform, so permission assignment is supported.
3. Importing multiple Excel files is supported.
4. Validate Data in Data Entry Attribute is supported, but Event Setting in Web Attribute is not supported.
Example
Plugin Installation
You can obtain the plugin at Excel Batch Import.
For details about installing the plugin in the designer, see Designer Plugin Management.
For details about installing the plugin on the server, see Server Plugin Management.
Adding the Link Node
Log in to the decision-making platform as the admin. Choose System Management > Directory Management >Directory Management > Data Entry, and click Add Link.
Set Name of the link to Batch Import, set Link Path to /webroot/decision/url/excel/submit, and tick PC as Terminal.
Assigning the Link Permission
Choose System Management > Permission Management, select Director in Human resources, and grant the director the View permission of Batch Import.
Adding the Batch Import Task
1. Choose Directory > Data Entry > Batch Import. Click Add Task, set Task Name to Task 1, and select the template %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\SpecialSubject|\ExcelImport\Excel_import_multiple_times.cpt from the drop-down list of Template.
2. Import, edit, or delete the task in Task List after you have added a task, as shown in the following figure.
3. Click the Task Permission tab, select Director in Human resources, and grant the director the View permission of Task 1.
Effect Display
Click and download the excelimport.xls file: excelimport.xls
Use the account of Lily (the director of human resources) to log in to the data-decision platform. (The default password for all users in FineReport is 123456.)
Choose Data Entry > Batch Import, and there is only Task 1 in Task List. Click the import icon and select the Excel file to import, as shown in the following figure.
Error Check
When you encounter an issue during the execution of the Batch Import function, the process will be aborted, and an error prompt. There are two common errors: the data validation error and the data submission error.
Data Validation Error
1. Set data validation to the template. The value of cell E3 falls within the range of 0 to 1000, and if not, an error message will be displayed, as shown in the following figure.
2. Modify the value of the Cost_price field in excelimport.xls to violate the data validation rule, as shown in the following figure.
3. Re-import the modified Excel file to the template, and then "Validation Error" will be displayed.
4. Click the prompt message button to check the error, as shown in the following figure.
5. Click Download Error File to automatically download the Wrong.xls file. Open the file, and you will see the error cell marked with a red background, as shown in the following figure.
Data Submission Error
If the error shown in the figure below occurs, it means that something is wrong when submitting the data to the database. At this time, you can check whether there is a setting problem with the corresponding template.
Notes
Although Batch Import eliminates the process of previewing the template, the performance of the function still has certain limitations. You are advised to import the Excel file with the total amount of data (rows multiplied by columns) below two million to avoid excessive server resource usage and longer import time. When the import time exceeds 25 minutes, the process will be eliminated and an error message of "process is null/timeout" will be returned.