Home » Developer & Programmer » Forms » Pre-insert not firing (Oracle forms 6i)
Pre-insert not firing [message #673113] Wed, 07 November 2018 03:49 Go to next message
Nembezah
Messages: 11
Registered: September 2017
Junior Member
Hi

I have a block that consist of pre-insert trigger
In the pre-insert there is a validation that checks if description field have value or not, if I insert new record with no description value validation is not popping up.

When I'm inserting or deleting the record it not inserted/deleted in the table. No error message displayed

The update is working fine.

I did put the message in the pre-insert it's not displayed.
jfpm_message(1001,null,'Maximum value in SEQ'||SPF_PALLET_TYPES_SEQ);




The Pre insert have the following code:

--PRE_INSERT CODE
:SPT_PALLET_TYPES.CANCELLED := 0 ;
SPT_PALLET_TYPES.ID := SPF_PALLET_TYPES_SEQ; --the function code returns the sequence form DB.

/*
create or replace FUNCTION "SPF_PALLET_TYPES_SEQ" RETURN NUMBER
IS
NEW_SEQ NUMBER(17,0);
BEGIN
SELECT SPS_PALLET_TYPES_SEQ.NEXTVAL
INTO NEW_SEQ FROM DUAL;
RETURN NEW_SEQ;
END;*/


if not( :SPT_PALLET_TYPES.DESCRIPTION IS NOT NULL ) then
jfpm_message(1000,null,'Description Requiered');
raise form_trigger_failure;
end if;

if not( :SPT_PALLET_TYPES.CHARGE IS NOT NULL ) then
jfpm_message(1000,null,'Charges Requiered');
raise form_trigger_failure;
end if;

if not( :SPT_PALLET_TYPES.CANCELLED IN (1, 0) ) then
jfpm_message(1000,null,'Cancelled can only be 1 or 0');
raise form_trigger_failure;
end if;


Re: Pre-insert not firing [message #673114 is a reply to message #673113] Wed, 07 November 2018 04:35 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
If the pre-insert isn't firing it's because forms thinks there's nothing to insert.
When you have a blank record and start filling in the fields oracle will set the :system.record_status of that record to INSERT. Then will you save it'll insert it and fire the pre-insert trigger.
So your record_status isn't going to INSERT.
Why that's the case I can't say since I know nothing about your form or how you're trying to use it.

I would move those validation checks to the appropriate when-validate-item triggers. I'd also rewrite those IFs to remove the NOT after the IF. I find your way counter-intuative, but that might just be me.
Re: Pre-insert not firing [message #673117 is a reply to message #673114] Wed, 07 November 2018 05:01 Go to previous messageGo to next message
Nembezah
Messages: 11
Registered: September 2017
Junior Member
Now I deleted the pre-insert trigger(with validation code).
created new record and save still not working.
Try to delete one record its also not working , record not deleted
but update is still working fine
Re: Pre-insert not firing [message #673119 is a reply to message #673117] Wed, 07 November 2018 05:04 Go to previous message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Well either forms thinks there's nothing to insert/delete or an error is happening and some code somewhere is swallowing the error.
For delete the latter is more likely (or you've managed to override key-delrec).
Try running the form in debug mode.
Stick a button on the form with a WBP trigger that displays the current :system.record_status. Check what it is at various points, see if it ever gets set to INSERT.
Previous Topic: Rows into Column.
Next Topic: Form Builder
Goto Forum:
  


Current Time: Thu Mar 28 11:36:03 CDT 2024