GO_BLOCK at WHEN_VALIDATE Trigger

I work with oracle forms. I have a procedure that I have to run whenever a certain field value changes. The procedure I must execute contains the go_block statement, which cannot be used in the when_validate_item trigger. Is there any way around this?

EDIT

I need to use the when_validate_item parameter, because the procedure that I must execute must be executed when the field changes, BUT BEFORE conducting the check.

+4
source share
3 answers

Usually there is a restriction on using GO_BLOCK or GO_ITEM on WHEN-VALIDATE-ITEM . However, there are several ways to overcome this. One way is to use the WHEN-TIMER-EXPIRED . Here's how -

WHEN-TIMER-EXPIRED

 Begin if GET_APPLICATION_PROPERTY(TIMER_NAME) = 'NEW_TIMER' then CALL_PROG_UNIT(); --This is your Procedure that calls the GO_BLOCK /*Do rest of validation here*/ end if; END; 

WHEN-VALIDATE-ITEM

 DECLARE timer_id TIMER; Begin timer_id := CREATE_TIMER('NEW_TIMER',1,NO_REPEAT); --set a short timer so that the WHEN-TIMER-EXPIRED trigger is fired immediately End; 

What happens is that the timer will be created and expired as soon as the CREATE_TIMER function is CREATE_TIMER , and then the WHEN-TIMER-EXPIRED will check the name of the expired timer and call your program block with GO_BLOCK , I hope this helps.


UPDATE

Mr Jeffrey Kemp wanted to see evidence that this solution worked. So here it is -

Oracle form with two blocks BLOCK1 and BLOCK2 with text elements on it

enter image description here

Launch WVI

enter image description here

Run the WTE form. This first calls PROGRAM UNIT P_CALL_PROC with a call to the GO_BLOCK function, and then performs some checks in the Number 2 field.

enter image description here

Here is P_CALL_PROC

enter image description here

And here is the result -

enter image description here

and

enter image description here

There is a Youtube link here to see the form in action.

+10
source

You can try using the POST-CHANGE trigger.

0
source

When I came across such problems, I usually could fix the problem with rewriting and / or redesigning the form itself. In other words, why do you need to use a procedure that moves focus to another element before validation?

In order to get around this problem, I should recommend that you read the "Forms" help to find out which triggers have problems with limited built-in functions. With enough knowledge of how the forms that it works, you should solve most of these problems. In rare cases where I could not solve the problem, I used a temporary solution.

0
source

Source: https://habr.com/ru/post/1436441/


All Articles