I. Overview
1. Problem description
When adding new records, if there are empty data under certain fields, it is hoped that the records where these empty data are located will not be stored in the database when submitting, which is equivalent to filtering out invalid records.
As an example in the following figure, all records whose cost price is specified to be empty are filtered out and not be stored in the database. So how to achieve such an effect?
2. Solution
Set the submission conditions in the Data Entry Attributes for data entry and filtering.
Data Entry Filtering refers to the judgment of the currently reported SQL data when the report is entered into the database. If the conditions are met, the SQL statement will be executed normally, and the database data will be modified. If not, the current SQL will be skipped and the next one will continue.
II. Example
Take the designer's built-in template Simple_Row-based_Form.cpt as an example. When inserting a record, if the value of the cost priceis empty, the record will not be stored in the database, and only when it is not empty can it be stored in the database.
1. Prepare template
Open the built-in template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Form\RowForm\Simple_Row-based_Form.cpt , as shown below:
2. Set submission condition
Select Template>Data Entry Attribute to enter the Data Entry Attribute setting interface, click Set Submission Conditions, enter the Submission Conditions setting interface, add a new submission condition: Cost_price not equal to "null", as shown in the following figure:
3. Preview effect
Save the template, click Data Entry Preview, insert a new record, the cost price is empty, click Submit, as shown in the figure below:
You can see that the record was not stored in the Product table, as shown in the following figure:
Note1: It is necessary to distinguish the difference between the Data Entry Verify and the Submission Condition. If the Data Entry Verify fails, the submission operation will not be performed, but the submission condition is only to filter the submitted data. If it is not satisfied, it will not be submitted. If it is satisfied, it will be submitted. Will interrupt the submission process.
Note2: Both App and H5 previews are supported.
III. Download template
Refer to the completed template: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\DataEntry\DataEntryApplication\Filter_blank_data.cpt
Click to download: