Reputation: 11
I have a date column that i've turned into a checkbox. How do I make it so when the date isn't null the checkbox is checked and if it is null then make it unchecked?
Upvotes: 0
Views: 590
Reputation: 143033
I'd rather keep my DATE
column as is, but make it hidden. Create another - checkbox item - and create (two?) trigger(s):
POST-QUERY
(which fires when you query existing data)WHEN-VALIDATE-ITEM
(which fires when you modify data on the screen)
Trigger code is simple (presuming that 0
means "not checked" and 1
means "checked"):
:block.checkbox_item := case when :block.date_column is null then 0
else 1
end;
If your Forms version doesn't speak CASE
, use DECODE
instead (it requires the SELECT
statement):
select decode(:block.date_column, null, 0, 1)
into :block.checkbox_item
from dual;
Upvotes: 2