Hey Creators,
We are back with another post on Creator Simplified . Today, we will learn how to validate records based on a criteria while importing data into a report.
Use case:
Assume a scenario where there’s a requirement to import student records into the Computer Science department, but only students with a percentage of 60% or higher are eligible.
From a data that contains all student records, let's validate the data and import only the records with a score of 60% or above into the Computer Science department.
How to achieve this?
1. Create a validation script
To validate records during import, we must first verify the data entered upon form submission, since importing records is essentially the same as making entries on the form.
First, let's create a validation workflow to allow entries on the form only if the percentage of marks scored is 60% or above.
This condition validates if the value entered in the Marks field is less than 60, the form will not be submitted.
2. Importing data into the report
The next step is to import the records into the report.
By default, clicking the Import button in the report will import all records without any validation. This occurs because the script we defined does not execute during the import process. To enable scripting during data import, we must check the Execute Scripts box to allow the scripting to work. This option is used in cases where a specific validation rule or a business logic needs to be applied during the import process.
After importing, the student records with Marks less than 60% will be shown under failed records as "Failed data" as it doesn't match the criteria.
The remaining records that matches the criteria will be imported.
Also, selecting the execute script check box triggers and executes any type of scripts on "validation on form submission" workflow.
That's all for today, we hope this post helped you learn how to validate records while importing data into a report.
Feel free to drop your suggestions/questions in the comments below and watch this space for more such posts.