How to Validate Product Information
Introduction
Case Introduction
This article will show you how to use the Validations on form submission feature to validate product No., product number, production date, and registration date, thus realizing the intelligent automation of product registration.
Application Scenario(s)
In the case of product registration, you may need to validate product information, such as product No., product number, registration date, production date, and so on. In this scenario, you can apply Validations on form submission to validate whether the production information is recorded correctly, thus regulating the registration process.
Preview
1. Add a condition in Validations on submission: If product No. is not a five-digit number, you cannot submit records. The effect of the validations on product No. is as follows:
2. Add a condition in Validations on submission: If the product number is not within 1 – 9999, you cannot submit records. The effect of the validations on the product number is as follows:
3. Add a condition in Validations on submission: When the product exceeds the shelf life of 180 days, you cannot submit records. The effect of the validations on the production date is as follows:
4. Add a condition in Validations on submission: When the registration date is not the current day, you cannot submit records. The effect of the validations on the registration date is as follows:
Setting Procedure
In the Product Registration form, you can only submit records when the product information meets the following validation conditions:
1. Customize the product No., and the product No. should be a five-digit number.
2. The product number should be within the range of 1 to 9999.
3. The registered products should be within a shelf life of 180 days.
4. The registration date must be the current day.
Designing a Form
When creating a Product Registration form, you can set fields as follows:
Field Name | Field Type |
Product Name | Single Line |
Product No. | |
Product Number | Number |
Production Date | Date&Time |
Registration Date |
Validation on Product No.
Go to Form Properties > Validations on form submission, and click Add Condition. On the Validations on submission page, enter Enter a five-digit valid number. for the prompt text, and set the formula as follows:
LEN(Product No.)==5
Validation on Product Number
Click Add Condition again. On the Validations on submission page, enter The number should be within the range of 1 to 9999. for the prompt text, and set the formula as follows:
AND(Product Number>=1,Product Number<=9999)
Validation on Production Date
Click Add Condition again. On the Validations on submission page, enter Register the products within the shelf life. for the prompt text, and set the formula as follows:
DAYS(TODAY(),Production Date)<180
Validation on Registration Date
As the TODAY function contains six parameters of year, month, day, hour, minute, and second, and the default format of the date and time field is YYYY-MM-DD, there are two methods for setting the validation conditions.
1. Directly validate with the TODAY function.
a. Click the Registration Date field, go to Field Properties > Type, and select YYYY-MM-DD HH:MM:SS.
b. Go to Field Properties > Validations on form submission > Add Condition. On the Validations on submission page, enter The registration date must be the current day. for the prompt text, and set the formula as follows:
Registration Date==TODAY()
2. Comprehensive validation based on the TODAY function.
Click Add Condition again. On the Validations on submission page, enter The registration date must be the current day. for the prompt text, and set the formula as follows:
Registration Date==TIMESTAMP(DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY())))