Try OpenEdge Now
skip to main content
ABL Essentials
Using Basic ABL Constructs : Defining an IF-THEN-ELSE decision point : Using the ABL Unknown value
 

Using the ABL Unknown value

Although the ShipDate is displayed as being blank in these cases, the value stored in the database isn't 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:
FOR EACH Customer NO-LOCK WHERE Customer.State = "NH" BY Customer.City:
  DISPLAY Customer.CustNum Customer.Name Customer.City.
  FOR EACH Order OF Customer NO-LOCK:
    IF Order.ShipDate NE "" THEN
      DISPLAY
        Order.OrderNum LABEL "Order"
        Order.OrderDate
        Order.ShipDate FORMAT "99/99/99" WITH CENTERED.
  END.
END.
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.