126
Views
5
Comments
Data validation before submit
Application Type
Reactive

Hello Dear,

Kindly help for reaching out solution of below request

I have build one app with excel import function. When user upload the excel then i want to apply validation before save the data in database.

Like If i want PAN card filed should be a 10 digit, Pin code will be 6 digit So if in excel user add 12 digit PAN card and any wrong entry.

Than data will not save in database and user will get a error message with comment. SO he will correct the data and upload the excel

Regards,

Urvashi Sharma

2026-02-26 06-29-24
Rahul
 
MVP

Hi @Urvashi Sharma ,

Just create one server action to validate all fields Like PanCard Value etc.

And check if it is passed and return a true value otherwise false.

And whenever you create a record in DB before add this validation based on the condition True/False.


UserImage.jpg
Urvashi Sharma

Hi @Rahul Sahu,

Can you share the logic or oml. file for better understanding. Because I have added an if condition, but issue is still there

Regards,

Urvashi

2019-07-05 10-57-41
Nikhil Purohit

Hi Urvashi,

Just with an addition to Rahul's solution, you can use Text Module's Regex_Search function to validate the data in Server Action and based on it's result you can proceed with the decision of committing your transaction into the database.

Also you can simply search the Regex patterns online for your concerned fields for validations.


Regards,
Nikhil Purohit

2023-05-30 10-05-13
Lourenço Matalonga

Hello @Urvrashi Sharma ,


all you have to do is on the submit action of the import excel you can add a server action where you pass the excel record and validate the inputs their, using for example the regex_search as referred by Nikhil above. Since you are saving the data after the validation is successful I advise you to do the validations on the server side for security reasons. And you can also create a structure where you have a boolean attribute named Success and a text attribute named ErrorMessage. You will create an output variable for the server action with the data type set to the structure we just created. Whenever the validation fails you assign the Success attribute to False and add a meaningful error message to the Errormessage attribute. Then show this message as an error message to the user. This will help the user identify what he/she has to fix.


Hope this helps you.


Best regards,

Lourenco Matalonga

UserImage.jpg
Urvashi Sharma

Hi @Lourenço Matalonga ,


Can you please share the OML file

Because i have new in outsystems


Regards,

Urvashi

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.