Boolean checkbox handling

When it comes to boolean values in the database there are many many different approaches, e.g. you can define a table column of data type number and use 1 or 0 as boolean values.
But there is much more and some of the solutions are better than others.

Over the last years me and my colleagues found using either 1/0 or Y/N as most useful solutions.

Now, if you want to visualize Boolean values in an APEX Form you most likely would like to go for a checkbox. Checked means true (1/Y), unchecked means false (0/N).

And there is the problem, APEX only knows one value for a checkbox, this is when it is checked. If the checkbox is not checked it is just NULL.

But instead of NULL we rather would like to store 0/N in the item.

So, what to do? Easy, just use the preconfigured LOV APEXLIB_BOOLEAN_Y_N or APEXLIB_BOOLEAN_1_0

oaa_boolean_checkbox

ApexLib ensures, that if the checkbox is unchecked the False-Value is stored in this item (either 0 or N).

2 thoughts on “Boolean checkbox handling

  1. This was just what i was looking for ,but i’m using Apex 4.2 and it doesnt have any preconfigured LOVs , do you know what the definition of this is if i need to define my own LOV to do this ?

    Many Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *