Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check box insert sysdate 1

Status
Not open for further replies.

robdunfey

Technical User
Apr 26, 2002
110
GB
Hi,

I have a field datatype=date. I want to put a checkbox on a form. When the box is checked I want the sysdate to be inserted into the field, when it is unchecked I want the value in the field to be set to null.

I have tried writing some pl/sql but i dont think this is required. I have since added the field item to a form, changed the item type to date, but when I type sysdate into the Value when checked property of the item, it says must be of DD-MON-YYYY format. So...

<B>How do I set the Value when checked property to SYSDATE?</B>

Please excuse the number of posts, but I am a novice and yet to find a suitable source of information. I have looked at the online documentation but could find no answers.

Many Thanks,

Rob
 
A Checkbox must have absolute values, not system variables such as SYSDATE.

1) You should create your checkbox with a checked value = Y and unchecked = N, and a datatype of CHAR.
2) Create a hidden text item which is the date field you want to populate with the current date.
3) Finally, in a PRE-INSERT trigger (as I am assuming you want the date entered when creating records), put something like this code:

[tt]IF :block.checkbox = 'Y'
THEN
:block.date_item := SYSDATE;
END IF;[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top