Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

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

  1. Add a Not Null constraint in the database for the Required properties.
  2. 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

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice