Home » Developer & Programmer » Forms » next_record executes When-Validate-Triggers of all items in the block (Oracle Forms 10.1.2.0.2)
next_record executes When-Validate-Triggers of all items in the block [message #581500] Mon, 08 April 2013 06:43 Go to next message
sasipalarivattom
Messages: 121
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member
Hi,

In one of my form , there is some code "next_record;" in the key-next-item trigger of one field.
Here before going to next record, it is executing the WHEN-VALIDATE-TRIGGER of all the items in that record.

Is it the default behavior of oracle forms?
Can we override this?

Thanks and Regards,
Sasi.
Re: next_record executes When-Validate-Triggers of all items in the block [message #581501 is a reply to message #581500] Mon, 08 April 2013 06:53 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
There's no "WHEN-VALIDATE-TRIGGER" trigger. So which one is it, really?

Anyway: item-level trigger fires when you navigate out of the item (which includes changing records). Record-level trigger fires when you navigate out of the record (which is what happens when NEXT_RECORD is executed). So yes, I'd say that this behavior is expected.

Why would you want to change it? It is the best option - check whether it is valid instantly. Another option is to move validation to, let's say, COMMIT phase. However, I guess your users won't be happy if they enter dozens of records and items and then get a message "Invalid item value". Which item? Which record?
Re: next_record executes When-Validate-Triggers of all items in the block [message #581654 is a reply to message #581501] Tue, 09 April 2013 12:07 Go to previous messageGo to next message
sasipalarivattom
Messages: 121
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member
Thanks for the reply.

Sorry, its When-Validate-Item trigger.

This is my condition.

There are 4 fields say F1,F2,F3,F4.

When validate item trigger of field F1 clears F2 and F3.
In F3 Key-Next-Item trigger, it check the value of F1 and if it is 1, control will go to next record skipping field F4.

The form execution is like below.
1. I give value 1 in F1 and go to next item.
2. When-Validate-Item trigger of F1 will clear F2 and F3.
3. Then I give some value in F2 and F3 and go to next item.
4. Key-Next-Item checks the condition and will send the control to next record.

5. When the control moves to next record, F1 field's When-validate-Item is fired again and it is clearing F2 and F3 again.

Thanks and Regards,
Sasi
Re: next_record executes When-Validate-Triggers of all items in the block [message #581682 is a reply to message #581654] Tue, 09 April 2013 18:29 Go to previous message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
You've missed something out there. If when-validate-item completes successfully the item it belongs to is marked as valid.
The trigger will not fire again unless the item is changed.
So something is changing f1 (even if it's setting it to the value it currently is) after the trigger initially fires.
Find that, fix it and your problem goes away.
Previous Topic: frm-92101
Next Topic: Saving a record in a table before saving an updated version
Goto Forum:
  


Current Time: Wed Jul 03 11:08:03 CDT 2024