Re: Designer/2000 - user triggers

From: Jacek Dobosz <jdob_at_ping.at>
Date: 1997/03/18
Message-ID: <332ff711.3998953_at_193.81.13.9>#1/1


On 18 Mar 1997 11:29:32 GMT, Piotr A. Szczygielski <party_at_apollo.umcs.lublin.pl> wrote:

>In comp.databases.oracle.tools Piotr A. Szczygielski <party_at_apollo.umcs.lublin.pl> wrote:
>> Hi all.
 

>> How can I add not-database triggers to generated form ?
>> I can define form-level triggers in template and it's ok - they appear
>> in new form. But what about block- or item-level triggers ?
>> When I create block, let's say XYZ in template and add any trigger there
>> then during generation I have an error that such block already exists
>> and it's not possible to generate it. I have no idea what to do.
>> Or maybe it's not possible at all ? :-(((
>> But I don't like to change the form manually after every generation...
>> I hope there's a way to solve this problem.
 

>> Party.
>
>Hm... I can't believe nobody knows. So this is something what people
>like me shouldn't know ! Yes - now I understand. Ok - good by my boss,
>good by my work, good by my Precious Oracle.
>:-))))
>Seriously - maybe it's an obvious answer - give me at least one.
>I really hadn't found it anywhere.
>
>Party.
>

There are many possibilities to enhance the functionality of generated forms ( triggers ) without the need to do it manually in forms designer after the generation process. All of them are based on the simple idea which is known as _hook point_. The cook book follows:

  1. Open one of the template in forms designer and add in the form level triggers you want to hook. Almost every trigger could be hooked, but some of them like POST-CHANGE may cause some performance issues.
  2. In every hooked trigger add three lines of code like this: -- hook point for the PRE-INSERT trigger BEGIN my_lib.do_pre_insert; END;
  3. Provide forms library xxx.pll which contains my_lib package with all dummy procedures like this

procedure do_pre_insert is
begin
  null;
end;

If you want to hook ON-XXX and KEY-XXX triggers, the standard functionality must be there provided, i.e in ON-INSERT trigger you must use insert_record built-in. and so on.

procedure do_on_insert is
begin
insert_record;
end;

4. Attach the xxx.pll library to the generated module with the preference MODLIB.

5. Set the preferences BLKTGS and ITMTGS to _before_ or _after_ to make your forms-level trigger working when the generator generate your own triggers on the block and item level.

6. Write your own code in the xxx.pll library when necessary, using indirect references like this:

procedure do_pre_insert is
h_name varchar2(80);
begin
  if name_in('SYSTEM.TRIGGER_BLOCK') = 'EMP' then     h_name := name_in( 'EMP.ENAME' );

    .................
    .................

    copy('HUGO', 'EMP.ENAME');
  end if;
end;

7. have fun

hope this helps

jacek Received on Tue Mar 18 1997 - 00:00:00 CET

Original text of this message