Support Article
Data table allows empty values
SA-77920
Summary
While inserting values to data tables, a Not Null constraint is applied for all the Required properties for a data table. When adding a new record on the Records tab of the data type, the user can enter values in a few of the Required properties and leave the other values blank, and also save the blank row.
Error Messages
Not Applicable
Steps to Reproduce
- Add a Not Null constraint in the database for the Required properties.
- Add a record for a data type by leaving some of the Required properties blank.
Root Cause
This behavior is as per PostgreSQL database
PostgreSQL database behaves differently from other databases in how it handles empty strings. In this case, when a property has a Null value, an empty string is returned and sent to the database.
Resolution
Perform the following local-change:
Add a restriction at the UI level.
Perform either of the following actions to add the restriction,
- Use Edit Validate rule on the property.
Use the below code,
if(null == theValue || "".equals(theValue)) {theProperty.addMessage("value can not be empty"); return true;}
- Add a Validate activity in that particular class. This activity is called for each record saved for that class. Set the Property or Page message when the property input is blank.
Published August 15, 2019 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.