Timer

Dicas do Oracle Forms Builder - Blocos, Itens, LOV, Canvas, Triggers, comandos, PLL, d2kwutil, FMB, Alert, menus, etc
Post Reply
LC_JK
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 46
Joined: Tue, 24 Aug 2004 2:02 pm
Location: São Paulo
Contact:

How do I create a timer that updates a field at a certain time?!

For example, if I want to create a digital clock that appears on my canvas .... I have the systems of system (System.Current_Datetime) ....
Every time I would have to be updating to get the time .... How do I do this?!
User avatar
tfg
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 83
Joined: Mon, 03 May 2004 3:38 pm
Location: Novo Hamburgo - RS

First, you need to create your timer. Where to create? (You decide this. It can be in pre-form, can be within a when-button-pressed, etc.)

there goes the steps:

Select all

DECLARE 
  hour_timer TIMER; 
  one_hour   NUMBER(7):=3600000;   -- expira de hora em hora 
BEGIN 
  --cria o timer "alarm",  de uma hora (em mili-segundos) 
  --(pode ser Repeat ou NO_REPEAT) 
  hour_timer:= CREATE_TIMER('alarm',one_hour,REPEAT); 
END; 

later, you have to create a when-timer-expired trigger. In it you put the code that you want to shoot.

.
LC_JK
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 46
Joined: Tue, 24 Aug 2004 2:02 pm
Location: São Paulo
Contact:

Thank you ...

I did it that way .... but I did not know if it was correct !!!

: -O
LC_JK
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 46
Joined: Tue, 24 Aug 2004 2:02 pm
Location: São Paulo
Contact:

Thank you ...

I did it that way .... but I did not know if it was correct !!!

: -O
LC_JK
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 46
Joined: Tue, 24 Aug 2004 2:02 pm
Location: São Paulo
Contact:

I mean, I did not know if it was the right way or if I had any other way to do it !!
User avatar
Toad
Rank: DBA Pleno
Rank: DBA Pleno
Posts: 253
Joined: Fri, 18 Nov 2005 2:14 pm
Location: Seattle, WA
Contact:
Matheus Gonçalves
matheus.dev
twitter.com/developer__c

An example to make use of the When-timer-expired:

Select all

 
DECLARE  
  tm_name  VARCHAR2(40);  
BEGIN  
	break; 
  tm_name  := upper(Get_Application_Property(TIMER_NAME));  
  
  IF tm_name = 'ALARM' THEN  
     :agora := sysdate; 
  END IF;  
END; 
That is, when it turns the timer, it updates the screen clock data .
User avatar
alef
Rank: Analista Pleno
Rank: Analista Pleno
Posts: 119
Joined: Tue, 06 Nov 2007 2:45 pm
Location: Patos de Minas - MG
Alexandre Matos
Patos de Minas - MG
Do interior de Minas para o resto do Mundo

Step-by-step tutorial for eventual research in the future.

First create the timer on the when-new-form-instance (or any other)

Select all

 
     DECLARE  
          temporizador Timer; 
          T NUMBER(5) := 60000; -- 1 minuto 
     BEGIN 
          temporizador := CREATE_TIMER('tempo', T, REPEAT); 
     END; 
, then create a trigger when-timer- Expired at forms level that Toad used as an example and making some modifications.

Select all

 
     DECLARE  
          tm_name  VARCHAR2(40);  
     BEGIN  
          break;  
          tm_name  := Get_Application_Property(TIMER_NAME);  
          IF tm_name = 'tempo' THEN  
               :Bloco.Relogio := sysdate;  -- acerta a hora atual. 
          END IF;  
     END; 
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests