Empty data is not stored in the database

  • Last update:  2021-05-19
  • 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?

    1.png



    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.png



    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.png


    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:

    4.png

    You can see that the record was not stored in the Product table, as shown in the following figure:

    5.png

    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: 

    Filter_blank_data.cpt


    Attachment List


    Theme: Data Entry
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy