Home » Developer & Programmer » Forms » Forms 9i - Trying to create a three reminder timer
Forms 9i - Trying to create a three reminder timer [message #184866] Fri, 28 July 2006 06:39 Go to next message
RayP
Messages: 4
Registered: July 2006
Location: UK
Junior Member
First time here and if I can expand on my very limited Forms knowledge I will be very grateful.

Here is the problem...

The application has been developed using Forms 9i Builder. It is on-line test that requires the user to answer 20 questions with a time limit of 1hr 30mins. There is a menu and the timer needs to start the moment the relevant menu option is selected.

I need to issue a reminder of time remaining at 30 minutes, 10 minutes and 1 minute. I have had success in running a single timer but don't know how to create one that keeps issuing a message.

I've created a CREATE_TIMER call in WHEN_NEW_BLOCK for the block containing the user responses to the questions. I have a WHEN_TIMER_EXPIRED trigger that is called when that timer expires but I don't know how to code it to issue repeated warnings about the time remaining.

The one example on Forms Help only served to confuse me. If anyone could provide a simple example I would really appreciate it.

Thanks.
Re: Forms 9i - Trying to create a three reminder timer [message #184889 is a reply to message #184866] Fri, 28 July 2006 09:02 Go to previous messageGo to next message
RayP
Messages: 4
Registered: July 2006
Location: UK
Junior Member
Here is the code in WHEN_TIMER_EXPIRED. I'm never hitting the code behind when global.timer_count=2. A three button message box seems necessary but I'm not sure of each action and what the buttons should be named. This is taken directly from the Oracle Help and doesn't seem to be very user-friendly Sad

Any help appreciated.

DECLARE
timer_id TIMER;
alert_id ALERT;

call_status NUMBER;
msg_1 VARCHAR2(80) := 'Wrap up the first phase of your presentation';
msg_2 VARCHAR2(80) := 'Move into your close.';
msg_3 VARCHAR2(80) := 'Ask for the order or repeat the close.';
eighteen_seconds NUMBER(6) := (18 * 1000);
nine_seconds NUMBER(5) := (9 * 1000);

BEGIN

:GLOBAL.timer_count := 1;

BEGIN
timer_id := FIND_TIMER('alarm');
alert_id := FIND_ALERT('alert_timeup');

IF :GLOBAL.timer_count = 1 THEN
	Set_Alert_Property(alert_id, ALERT_MESSAGE_TEXT, msg_1);
	call_status := Show_Alert(alert_id);
	IF call_status = ALERT_BUTTON1 THEN
		Delete_Timer(timer_id);
		Next_Record;
	ELSIF
		call_status = ALERT_BUTTON2 THEN
		:GLOBAL.timer_count := 0;
	ELSE
		Set_Timer(timer_id, eighteen_seconds, NO_CHANGE);
	END IF;
ELSIF :GLOBAL.timer_count = 2 THEN
	set_Alert_property(alert_id, ALERT_MESSAGE_TEXT, msg_2);
	call_status := Show_Alert(alert_id);
	IF call_status = ALERT_BUTTON1 THEN
		Delete_Timer(timer_id);
		Next_Record;
	ELSIF
		call_status = ALERT_BUTTON2 THEN
		:GLOBAL.timer_count := 0;
	ELSE
		Set_Timer(timer_id, nine_seconds, NO_CHANGE);
	END IF;
ELSE
	set_Alert_property(alert_id, ALERT_MESSAGE_TEXT,msg_3);
	call_status := Show_Alert(alert_id);
	IF call_status = ALERT_BUTTON1 THEN
		Delete_Timer(timer_id);
		Next_Record;
	ELSIF
		call_status = ALERT_BUTTON2 THEN
		:GLOBAL.timer_count := 0;
	ELSE
		Set_Timer(timer_id, NO_CHANGE, NO_REPEAT);
	END IF;
END IF;
:GLOBAL.timer_count := 2;
END;
END;
Re: Forms 9i - Trying to create a three reminder timer [message #186188 is a reply to message #184889] Sun, 06 August 2006 20:58 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I would have created three separately named timers in the When-New-Block trigger. However, as you said, this example is directly from the reference manual.

I think there is a bug in the reference manual code. In the '=1' code I think you need to set the 'timer_count' to '2', and in the '=2' code you have to set it to '3'.

David
Re: Forms 9i - Trying to create a three reminder timer [message #186237 is a reply to message #186188] Mon, 07 August 2006 02:45 Go to previous messageGo to next message
RayP
Messages: 4
Registered: July 2006
Location: UK
Junior Member
Thanks for replying. I managed to work out what was going wrong. The global variable was being reset to 1 each time the When_Timer_Expired trigger was called.

I declared and set it in the When_New_Block trigger and incremented it after each timer expired. Much the same as you suggested.

Pretty shambolic help from Oracle. More like hinderance than help!

Thanks.

[Updated on: Mon, 07 August 2006 02:47]

Report message to a moderator

Re: Forms 9i - Trying to create a three reminder timer [message #186250 is a reply to message #186237] Mon, 07 August 2006 03:07 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I still prefer having three seperate timers. Then there are no 'extra seconds' placed in the timing because you haven't pressed 'yes' fast enough.

David
Re: Forms 9i - Trying to create a three reminder timer [message #186252 is a reply to message #186250] Mon, 07 August 2006 03:17 Go to previous message
RayP
Messages: 4
Registered: July 2006
Location: UK
Junior Member
If I understand you correctly the timer is not counting down whilst the user delays pressing the OK button. Fair comment but they won't be able to navigate to a different question until OK is pressed. They won't know that of course.

I'll try three separate timers and hopefully not mess up the code - thanks.
Previous Topic: changing the text according to selection..can this be done using text_io package?
Next Topic: HELP : v$session.module
Goto Forum:
  


Current Time: Fri Sep 20 09:51:01 CDT 2024