Display Date and Time [message #84695] |
Sun, 18 April 2004 17:16 |
lotus
Messages: 10 Registered: March 2004
|
Junior Member |
|
|
hi
i wonder is it possible to display both date and time in a form during runtime and the seconds will change, i mean is moving. i don't want it to be in the database as a field.
is there a label or somthing to do this?
|
|
|
Re: Display Date and Time [message #84702 is a reply to message #84695] |
Mon, 19 April 2004 07:35 |
jan
Messages: 71 Registered: August 2002
|
Member |
|
|
you can create a when-timer-expired tigger.
procedure:
1. create a text or display item which will display the time. lets say ti_timer
2. create a when-timer-expired trigger on form level.
3. enter the following code in trigger body.
DECLARE
my_timer_id TIMER;
BEGIN
my_timer_id := CREATE_TIMER('my_TIMER', 1000, REPEAT);
-- my_timer is your timer name.
-- 1000 is one second ( 1000 milli seconds)
-- repeat is to repeat every second.
IF ID_NULL(my_timer_id) THEN
MESSAGE('Timer Not Created');
RAISE FORM_TRIGGER_FAILURE;
END IF;
:ti_timer := to_char(sysdate,'mm/dd/yyyy HH:MI:SS');
END;
Hope this helps
Jan
|
|
|
Re: Display Date and Time [message #84703 is a reply to message #84702] |
Mon, 19 April 2004 16:29 |
lotus
Messages: 10 Registered: March 2004
|
Junior Member |
|
|
hi
thanks for ur reply. i've create a display item named "ti_timer" and create a "When-Timer-expired" trigger at form-level. but when i run it, the display item is empty, y? do i have to change some property of "Ti_timer" ? btw abt the timer name "my_TIMER", is it jus a name or it have to be created somwhere?
|
|
|
Re: Display Date and Time [message #84704 is a reply to message #84703] |
Mon, 19 April 2004 17:22 |
jan
Messages: 71 Registered: August 2002
|
Member |
|
|
Oops I'm sorry... my mistake...
i forgot to mention about the when-new-form-instance trigger...
actually you'll write the code in when-new-form-instance trigger
DECLARE
my_timer_id TIMER;
BEGIN
my_timer_id := CREATE_TIMER('my_TIMER', 1000, REPEAT);
-- my_timer is your timer name.
-- 1000 is one second ( 1000 milli seconds)
-- repeat is to repeat every second.
IF ID_NULL(my_timer_id) THEN
MESSAGE('Timer Not Created');
RAISE FORM_TRIGGER_FAILURE;
END IF;
END;
and then in when-timer-expired trigger, you set the value of the ti_timer item to date and time.
:ti_timer := to_char(sysdate,'mm/dd/yyyy HH:MI:SS');
NOTE: my_timer, ti_timer, my_timer_id all are just any variable. you can have any name you want to..
Hope this helps
JS
|
|
|
|