TisButaScratch
TisButaScratch

Reputation: 173

Dealing with Null values oustystems

I have built in the functionality for a user to upload data from an excel file in my web app. However if the any of the cells contain null values then the upload does not work as it attempts to convert a " " string into an int or date.

I know the data fed into this tool will commonly contain null values. Any suggestions on how to deal with this issue would be greatly appreciated.

Thanks

Upvotes: 1

Views: 2179

Answers (2)

Tom
Tom

Reputation: 1

I know this is resurrecting an old thread, but as this is one of the first results if you google about the Outsystems surrogate NULL, and this is an important consideration.

Note that a boolean of 0 will be NULL in your database. So if, in an aggregate, you want to check if boolean = false, field = false or field <> true will not work because null = false. you have to use (field = true) = false

Similarly, with their dates, (field <> nulldate()) = false

Upvotes: 0

Miguel Seabra Melo
Miguel Seabra Melo

Reputation: 399

In the interest of simplicity, OutSystems does not support NULLs for scalar/string types (only keys). Therefore you will either need to

  1. Have a specific value of the type reserved to be understood as null (e.g. 0 or -1 for Integer, "" or "NULL" for Text etc). Which value to use is highly dependent on your value space;
  2. Have an extra (Boolean) column in the excel that states if the associated column's value should be understood as NULL.

In the later case, you will likely need to also propagate this boolean to your data model (if you need to keep track of these NULLs at a later date).

Upvotes: 2

Related Questions