cancel
Showing results for 
Search instead for 
Did you mean: 

Datatype for three state boolean: null/true/false

DisplayName2
Participant
0 Kudos

I need to write down the information: yes/no. This is a logical bool value. But I still want to know whether this value has been set or not. Ideally, you'll want to have a data type that starts null.

Then I could check:

var foo = this.Answer;

if (foo.IsSet())

{

if (foo) then ... else ...

}

I would also like there to be a UI element for this, which would be grayed out if this.Answer is equal to null, marked with a check mark if it is true, etc.

Accepted Solutions (1)

Accepted Solutions (1)

ThiagoSarmento
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Tomasz,

How about this? Answer field data type comes from a custom created .codelist, having the value 1-Yes and 2-No.

Considering that the variable foo holds the value from Answer (which can either Yes/No/Null), you can use IsInitial() to valide if the variable is null or not.

var foo = this.Answer;
-> if (foo.IsInitial()) //Answer is null
-> if (!foo.IsInitial()) //Answer is either yes/no

Answers (0)