URGENT : key-commit trigger
392544Sep 22 2005 — edited Sep 22 2005Hi all,
I use R6i patch 17 with oracle 10g.
My form contains three database datablocks which do not have any relations between them but the last two datablocks have their "where clause" property set to "comp_coord = :avd1.comp_coord" . I mean that the first block is named avd1 , and the two blocks are named btp1 and ctp1.
The blocks btp1 and ctp1 are multirecord , 7 records displayed.
The "OK" button in the toolbar has the code "do_key('commit_form') in its trigger. And I want to verify something before committing changes : I count the number of records entered in block btp1 ; and when it is less than 3 then an alert is displayed stating that the user should enter at least three records in btp1 !
This test works fine . But when three or more records are entered in btp1 then my forms is commited without checking the PRE-INSERT trigger associated for the last datablock ctp1 !
Here is the code for the key-commit form trigger :
count_btp;
commit_form;
And here is the code of the count_btp procedure :
PROCEDURE compter_btp IS
nb number := 0;
BEGIN
go_block('btp1');
first_record;
loop
exit when :system.record_status = 'NEW';
nb := nb + 1;
next_record;
end loop;
if nb < 3 then
affiche_erreur('LEAST_3_BTP'); -- it displays the alert stating that 3 records are required
end if;
END;
And here is the PRE-INSERT trigger for the block ctp1 :
IF :CTP1.SERIAL_NUMBER IS NULL or
:CTP1.AGR_FIELD_STRENGTH IS NULL or
:CTP1.CAL_FIELD_STRENGTH IS NULL or
:CTP1.LONGITUDE IS NULL or
:CTP1.LAST_CHANGE_DATE IS NULL or
:CTP1.LATITUDE IS NULL
THEN
affiche_erreur('CHP_OBLI_ABSENT'); -- it displays an alert stating that there are empty fields
END IF;
So my problem is that this PRE-INSERT trigger does not fire and the table associated for the ctp1 block is always empty in the database !
So help me to resolve this problem.
Thank you very much indeed.