Oracle Apex 19.1 - Create a checkbox example.

Oracle Apex 19.1 - Create Checkbox of Yes/No Type

This Oracle Apex tutorial shows you, how to create a checkbox of Yes/No type. To demonstrate this example I am using Oracle Apex version 19.1.

Mostly, we used to create checkboxes to indicate and store flag values, such as Y/N for Yes/No, T/F for True/False, etc. Similarly, for this example, I will create a checkbox for a field ACTIVE_CUSTOMER having data type Varchar2 size 1, to store Y if checkbox checked and to store N if unchecked.

Create Checkbox in Oracle Apex to Store Y/N for Yes/No Values

In Oracle Apex page designer, select or create a new page item for a flag field for which you want to create a checkbox. Then change the type of the item as Checkbox and set the following property settings:

  • Settings > Number of Columns: 1
  • List of Values > Type: Static Values
  • Display Extra Values: No
  • Static Values: Then click on the button for static values and add the values as shown in the below image:

Oracle Apex 19.1 - Create a checkbox example.

Now we have specified the checkbox checked value as Y. But what if the user will uncheck the checkbox, we need to store the value N for it. To do this follow these steps:

Do the right-click on the checkbox item and select Create Computation and set the following properties:

  • Point: After Submit
  • Computation > PL/SQL Expression: nvl(:P20_ACTIVE_CUSTOMER, 'N');

Below is the screenshot of the above settings:

Oracle Apex computation settings.

The above PL/SQL expression will execute at the time of page submit and will assign the value N if the checkbox is unchecked means the value of page item P20_ACTIVE_CUSTOMER is null.

Save the changes and run the page to test.

Related tutorials:

This Post Has 6 Comments

  1. Raj

    Hi Vinish,
    that was helpful. Thanks

  2. Itzik B

    Thanks your guide is very clear and easy to understand

  3. John Graham

    Thanks for this - very clear and helpful

  4. Ankita

    I have a doubt like if we are clicking on checkbox then in reports one column few values should be visible

  5. Ankita

    Please can you help me with this

    1. Vinish Kapoor

      Please ask your question on orclqa.com with more details.

Comments are closed.