Comparison of Null Values#

Any column that does not have a value is known as being "NULL or UNKNOWN" and whenever you compare anything to a Null value the result will always be false (down the ELSE path). Also important to note is that NULL is not equal to another NULL, nor is it "not equal" - it is unknown.

To work around this you need detect when a column has a Null value and initialize it.

In this workflow usercalc, we want to see when a value has changed in a given field. The easy and obvious solution is to test new value against old value like this:

5000 IF NV EID.DRIVERS_LICENSE EQ OV EID.DRIVERS_LICENSE 5100 5500

If either the new value (NV) or old value (OV) are NULL, the condition will be false and you will always go down the else branch - even when they are both NULL.

To deal with this scenario, we have to use some variables (recommended to be character type) and additional logic using the EQNL operator.

5000 LET V NV_DL EQNL NV EID.DRIVERS_LICENSE A No Value 5010
5010 LET V OV_DL EQNL OV EID.DRIVERS_LICENSE A No Value 5020
5020 IF V NV_DL EQ V OV_DL 5100 5500

When using this technique you must always use a value (in this case the alpha "No Value" that would never actually be in the field you are comparing to in order to correctly check that there was a change occurring.


Notes #

Click to create a new notes page