1

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

TisButaScratch
  • 163
  • 1
  • 5
  • 17
  • While your question centers on how to detect a "null", you appear to be mixing in a wrong type conversion problem. For the record, these should be totally unrelated. You fix type conversion by adjusting the type of the target Attribute for the excel column. – Miguel Seabra Melo May 23 '18 at 10:11

2 Answers2

2

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).

  • I had thought about method 1, but hadn't considered method 2. Since my integer values can be positive and negative i will have to create a Boolean, thanks! – TisButaScratch May 23 '18 at 10:20
0

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

Tom
  • 1