38
Views
5
Comments
why there is no null value for boolean
Discussion

I can't assign a null value to a boolean why is that and what if i want it to be null and false means something 

2025-02-18 16-35-39
Lotte Kuiper
 
MVP

Hi Sara,

Booleans are meant to represent binary states like on/off or yes/no.
If you need a third state, you can consider creating a static that has 3 records like so.
Another option is to use 1 for True, 0 for False and -1 for Other.

UserImage.jpg
Sarah Mohammed

Great idea to work around this,

Thank you 

2025-02-18 16-35-39
Lotte Kuiper
 
MVP
2024-12-18 16-06-42
Junaid Syed

Hello Sara,

OutSystems does not support null values except for identifiers, all other data types have an associated default value. You can learn more about data types here.

BTW may I know what is your use case for assigning null value to a boolean data type?

Junaid

2016-04-22 00-29-45
Nuno Reis
 
MVP

Hello.

I answered this same question in classes just days ago.

Think of Boolean as a checkbox. Do you accept the terms and conditions? Do you have a driver's license? Are you bringing a pet? Until you say Yes, it is No. There is no Null, because the absence of answer is itself an answer.

In Actions, the same happens on each If. Unless it is True, it's False.


If your type of question is slightly different, the answers will also be.

Is this book any good?  You can just say Yes or Bo. You also have the "I haven't read it yet". That is not a binary decision, but a ternary.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.