Can a UD Field Have a Nullable Boolean Data Type (bool?)?

Hello. I’m wondering if it’s possible to setup a UD Field with a nullable boolean data type. Specifically, I want to ensure that the end-user interacts with a checkbox to indicate a “Yes” or “No” answer. On the screen customization I used Radio Buttons as I think that a checkbox with a black center would be confusing to the end-user, so I convert the Yes/No clicks to True/False on the custom checkbox. I know I can create a variable with a data type of “bool?” but I’ll also need to interpret the stored value of the boolean to determine how to populate the Radio Buttons correctly. Does anyone have any thoughts on this one? Thanks.

Due to some rules that Epicor set a long time ago, we theoretically do not have “null” values in our table sets. Yes, it is possible for SQL to have a null valued boolean, giving it a tri-state (true, false, and null), but in Epicor land, we dont typically use that.
Have you thought about using a COMBO box instead of a boolean? the result of the combo could be “T” or “F” or 1 and 0…

1 Like

Well, @timshuwy answered the technical question, so I’ll take a stab at the other.

If you like radio buttons, and have a need for an unitialized, or tristate field, just use
an integer, or a character field.

Then chose a value for each. Requires a tiny bit of code, but the end result is the same.

"true" = true
"false" = false
String.Empty ("") or any other value = null //String.Empty is nice because it's the default value
< 0 = false
0 = null //nice because it's the default value
> 0 = true

Obviously choose something that makes sense to you and is easily documented.

Thanks for the info gentlemen. Realizing that the short answer is “NO”, I went ahead and changed the UD field to a string, and used grouped Yes/No radio buttons to complete the task.