Home » Developer & Programmer » Forms » Oracle Forms 6i (when-validate-item trigger)
Oracle Forms 6i (when-validate-item trigger) [message #84854] Wed, 05 May 2004 13:39
ASIF
Messages: 10
Registered: April 2002
Junior Member
Oracle Forms 6i

Hi,

I have a multi record block. Field(A) is a text item....

1) I click into Field(A)

2) Type is a 4 charcter code and press enter on keyboard (key-next-item)....this causes a when-validate-item trigger to fire which fetches data for various other records for that row...e.g code_name....code_ref..... etc etc

It also positions the cursor into the next record(which is empty) ready for the next code to be entered.....

The problem is that no duplicate codes can be entered nor at this point is the data committed to the db.

I could put the following code in the key-next-item trigger on Field(A) so that it shows an alert if a code already exists in the block.......

------------------------------------------------------------

declare

   v_rec_num   number;

   v_continue   varchar2(3) := 'YES';

begin

   v_rec_num := :system.trigger_record;

   If :block.field_a is not null then

     v_code := :block.field_a;

      go_record(1)

      while :block.field_a is not null loop

          if upper(:block.field_a) = upper(v_code) then

            message('Code Already Exists');

            v_continue := 'NO';

            exit;

          else

             next_record;

          end if;

          exit when :system.trigger_record = v_rec_num;

        end loop; 

        if v_continue = 'NO' then

          last_record;

          clear_record;

        else....................

        end if;

     end if;

end;

--------------------------------------------------------------

How can I implement the above in a when-validate-item trigger(wvi)? This is crucial because if I have put in a duplicate code and clicked on a different block the code is not validated as key-next-item is not fired!

I am aware that certain built-in (eg. clear_record ) cannot be used in a wvi trigger. I have tried using timers to get around this put it does not give me the desired result....unlike the code above which works fine.
Previous Topic: generate access97 using sql server as backend - urgent
Next Topic: Can you print just the contents of a list item?
Goto Forum:
  


Current Time: Tue May 07 10:28:28 CDT 2024