Omnis Technical Note TNDM0004

NULLs in expressions and Omnis

For Omnis Studio
By Omnis Technical Support

Deprecated Content
Due to its publication date, this technote contains information which may no longer be accurate or applicable on one or more of the platforms it refers to. Please refer to the index page which may contain updated information.

Sometimes NULLs can seem to cause a problem. For example, if you execute the following code:

If X=10 or Y=10
   OK message
END IF


and either value is 10 but the other one is NULL, then the result will always be false. This may seem to be an Omnis problem initially but it is not so. Why isn't this a bug?

The Omnis rule is straightforward, if any term of an expression is NULL the whole expression evaluates to NULL. For NULL read 'undefined', so the logic is that once part of something is undefined the whole is undefined. Clearly it is possible to argue about expressions involving ORs and it is certain that over the years standards committees have spent much time doing just that (discussion here would probably involve the role and concept of NULLs in formal database theory). But the beauty of the Omnis approach is its simplicity, it is easy to understand and all the developer has to do is make sure whenever a NULL can occur in an expression it is handled properly.

NULLs can be a nuisance and, in the opinion of some, have almost no redeeming features. However, developers have to choose whether they have advantages that outweigh their disadvantages. The NULL rule in Omnis is simple and therefore both easy to adhere to and work with.

Search Omnis Developer Resources

 

Hit enter to search

X