Differences between null value properties and properties with no value
Pega® Platform treats properties that have a null value differently from properties that do not have a value. Understanding the differences between these two conditions and understanding which function to use to determine whether a property exists or has a value helps ensure that you get the results that you want.
Null value properties are not stored on the clipboard or in the database and are treated as if they do not exist.
- The value of a property that is on the clipboard and is a valid property that was not previously on the clipboard is an empty string.
- When you use the Property-Set method to set a property value to null, nothing is stored on the clipboard or in the database. If the property is exposed as a database column, the column value is null.
- When testing values in a decision table rule, you can reference a column by using a function. The value of the column can be a call to a function. To ensure that you are passing a property that exists, you can call the function that checks whether a property exists or you can check whether the length of the property is zero.
Use the following functions to determine whether a property exists and whether a property has a value.
- PropertyExists() indicates whether a property exists, that is, whether it is on the clipboard page. This function returns false when the property value is null.
- PropertyHasValue() can be passed either with a property reference or a text string. For property references, PropertyHasValue() indicates whether the property has a value. For a text string, PropertyHasValue() indicates whether the property exists and whether it has a value.
- If you call PropertyHasValue() with a property reference, the function returns true if the value of the property has a length greater than zero; otherwise, it returns false.
- If you call PropertyHasValue() with a text string as a parameter, for example, .pyLabel, the function returns false if the property either does not exist or is on the page but has a zero-length value; otherwise, the function returns true.