Use the ABL Unknown value
- Last Updated: October 6, 2023
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
Although the ShipDate is displayed as being blank in these
cases, the value stored in the database is not a blank value, because this is a date, not a
character value. If you were to add an expression to your code to compare the
ShipDate to a blank value, you would get your very first ABL compiler
error:
|
Whenever you press the F2 key to run your procedure, the AVM performs a syntax validation. If it cannot properly process the code you have written, you get an error such as this one:
In this case, the AVM sees that you are trying to compare a field defined to be a date with a character string constant, and these do not match. To correct this, you need to change the nature of your comparison.
The value stored in the database to represent a value that is not defined is
called the Unknown value. In ABL statements you represent the Unknown value with a question
mark (?). Note that you do not put quotation marks around the question mark;
it acts as a special symbol on its own. It is not equal to any defined value. In ABL, you
write a statement that looks as though you are comparing a value to a question mark, such as
IF ShipDate = ?, but in fact the statement is asking if the
ShipDate has the Unknown value, which means it has no particular value at
all. The Unknown value is like the NULL value in SQL, and the
expression IF ShipDate = ? is like the SQL expression IF ShipDate IS NULL.