Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Post-Query and Record , Block status

Eslam_ElbyalyJun 23 2015 — edited Jun 28 2015

hi ,

i am using forms 6i ,

the form has the EMP block without the ENAME item , i deleted it and put a non-db item (NAME) to retrieve the ENAME into it to test the status of the record and block .

when the text-item i put is non-db item and you get the values in the post-query trigger , the status of the record and block should be CHANGED ,

but this does not happen ? !! the value of the both is QUERY .

- The post-query trigger has this :-

select ename into :emp.name from emp where empno = emp.empno ;

Comments

juliojgs

CHANGED record status, as I understand it, doesnt' mean that you changed it, it means that the record is actually marked to generate an update sql sentence when the post process happens later. If you just change a non-db item, that doesn't imply that the record will have to issue an update sentence, so the record is still in QUERY status.

Zlatko Sirotic

If the POST-QUERY trigger changes non-database item, the transaction status remains QUERY, but the validation status (of the row) changes from VALID to CHANGED.

That is why we need to use this (in POST-QUERY):

SET_RECORD_PROPERTY(:SYSTEM.TRIGGER_RECORD, 'your_block', STATUS, QUERY_STATUS);

We indirectly return the validation status (of the row) from CHANGED to VALID, "changing" transaction status from QUERY to QUERY.

It looks weird, but it works.

Regards,

Zlatko

Eslam_Elbyaly

Thanks for reply , but i understood nothing ,

- when you select a value in a non-db item like i said above , then you tried to exit the form , it will ask you saving changes , which means the record status is " CHANGED "

and we avoid this by using

SET_RECORD_PROPERTY(:SYSTEM.TRIGGER_RECORD, 'your_block', STATUS, QUERY_STATUS);

all that does not happen to me .

Zlatko :-

i think you are the one who told me before to use SET_RECORD_PROPERTY(:SYSTEM.TRIGGER_RECORD, 'your_block', STATUS, QUERY_STATUS); in a similar situation .

what changed now ?

CraigB

salute-Salem wrote:

Thanks for reply , but i understood nothing ,

- when you select a value in a non-db item like i said above , then you tried to exit the form , it will ask you saving changes , which means the record status is " CHANGED "

...

You will be asked to save changes when either the FORM_STATUS, BLOCK_STATUS or RECORD_STATUS is 'CHANGED', 'INSERT' or 'NEW'.  Selecting a value into a Non-DB item is not supposed to change any statuses.  Can you confirm that populating the non-db is truly the cause of the problem?

Craig...

Zlatko Sirotic

Try first to write this:

-- POST-QUERY

select ename into :emp.name from emp where empno = :emp.empno; -- NOT emp.empno

-- WHEN-VALIDATE-RECORD

MESSAGE('WVI'); PAUSE;

Then add SET_RECORD_PROPERTY:

-- POST-QUERY

select ename into :emp.name from emp where empno = :emp.empno;

SET_RECORD_PROPERTY(:SYSTEM.TRIGGER_RECORD, 'emp', STATUS, QUERY_STATUS);

Do you see the difference?

In the first case the message 'WVI' appears, but not in the second case.

And - in both cases, you can leave the Forms module without question "Do you want to save changes".

Regards,

Zlatko

Eslam_Elbyaly

No , unfortunately you do not understand me ,

i am saying that if i use the select statement above in the post-query trigger , then i try to exit the form, i should see the " do you want to save changes " message ,

and that does not happen .

Zlatko : this is the answer you provided in another thread of me

Each record has the transaction status (which can be NEW, INSERT, QUERY, CHANGED) and the validation status (which can be NEW, CHANGED and VALID).

(The block has the transaction status only, and the item has the validation status only.)

In the POST-QUERY trigger, when we are filling the database item, the transaction status changed from QUERY to CHANGED, and the validation status changed from VALID to CHANGED.

When we are filling the non-database item, the transactional status remains QUERY, but the validation status changed from VALID to CHANGED !

We can not directly return validation status to VALID, and we use:

SET_RECORD_PROPERTY (:SYSTEM.TRIGGER_RECORD, :SYSTEM.TRIGGER_BLOCK, STATUS, QUERY_STATUS);

not to return the transaction status to QUERY (because he stayed QUERY), but to return the validation status to VALID !

- I do not know what is happening , it works in a form i have (now ) -- same situation ( selecting values in a non-db item in a post-query trigger ) , when i try to exit the form it asks me to save

, and it does not work in another form !!

either u debug or use

WHEN-WINDOW-CLOSED trigger

EXIT_FORM('NO_VALIDATE');

Amatu Allah.

HamidHelal

Can you take a Post-Change trigger at empno

and put your code

select ename into :emp.name from emp where empno = :emp.empno ;

No need of POST-QUERY trigger.

then ? status of the block ?

Zlatko Sirotic

> I do not know what is happening, it works in a form i have (now) ... , and it does not work in another form !!

If both programs work on the same Forms Runtime version (the last Forms 6i client-server version is 6.0.8.26.0.), then there must be some difference in your programs.

Regards,

Zlatko

Eslam_Elbyaly

this is my version with which i developed the two forms

Forms [32 Bit] Version 6.0.8.11.3 (Production)

- i do not know if you understand me or not , i will ask it in another way ,

- if i select a value from the database in a non-db text item in a post-query trigger , then try to check for the record status , what status should i get ?

Zlatko Sirotic

You should get QUERY transaction status (eg. using GET_RECORD_PROPERTY (:SYSTEM.TRIGGER_RECORD, :SYSTEM.TRIGGER_BLOCK, STATUS) in POST-QUERY).

But, validation status is CHANGED.

Regards,

Zlatko

Eslam_Elbyaly

That's what i am doing Zlatko , what i am saying is

if the validation status is CHANGED then i should see a message asking me to save the changes when i try to exit the form , right ?

Zlatko Sirotic

When you change the non-database item, only this will be changed:

- the validation status of the item, from VALID to CHANGED

- the validation status of the row, from VALID to CHANGED.

This will not be changed:

- the transaction status of the row remains QUERY

- the transaction status of the block remains QUERY

- the transaction status of the Forms module remains QUERY.

So, you should not see a message "Do you want to save changes".

Regards,

Zlatko

Eslam_Elbyaly

This the answer for my question , but i do not understand , if so , then why are we using the set_record_property(..... status ) in the post query after retrieving data

in a non-db item ? why would i change the validation status if it does not cause problems to me  ? or it does ?

Zlatko Sirotic

We use SET_RECORD_PROPERTY (..., QUERY_STATUS) in the POST-QUERY because we do not want that WHEN-VALIDATE-RECORD trigger (if exists) runs during query.

As I have said before, we indirectly return the validation status of the row from CHANGED to VALID, "changing" transaction status from QUERY to QUERY.

It is not very intuitive, but we have to accept that this is how Forms works .

Regards,

Zlatko

Eslam_Elbyaly

we do not want that WHEN-VALIDATE-RECORD trigger (if exists) runs during query.

Why this trigger (specifically) ?

what about when-validate-item ? or any other validation trigger ?

can i avoid using it if i do not have the above validation triggers ?

Zlatko Sirotic

In addition to the WHEN-VALIDATE-RECORD trigger, SET_RECORD_PROPERTY (..., QUERY_STATUS) affects the WHEN-VALIDATE-ITEM trigger (but, most often there is no reason to create WVI for non-database item).

If you do not have WVR or WVI (for non-database item), you do not need to use SET_RECORD_PROPERTY.

If you are using updateable join views (I would recommend to use), then you do not need PRE-QUERY and POST-QUERY triggers,

and then you certainly do not need SET_RECORD_PROPERTY in POST-QUERY trigger .

Regards,

Zlatko

As Salamu alikum We Rahamatu Allah We Barakatu,

pls. check this blog: Talk2Gerd: Set Record-Status to Query after a POST-QUERY

Amatu Allah.

Eslam_Elbyaly

Oh Neveen , you opened the thread again ,

the link says that the record status is changed , and did not say the " Validation Status " , and i really do not know what is happening !!

i have another form which has a db-block with non-db items which get their data in this post-query trigger

DECLARE

    V_MAX_FACTOR NUMBER ;

BEGIN

SELECT S.ITEM_ENG_NAME , S.ITEM_ARABIC_NAME , S.MAX_TO_MIN_FACTOR , U.UNIT_NAME

INTO :ITEM_DETAIL.ITEM_ENG_NAME , :ITEM_DETAIL.ITEM_ARABIC_NAME ,V_MAX_FACTOR ,:ITEM_DETAIL.MIN_UNIT_NAME

FROM STOCK S , UNITS U

WHERE S.MIN_UNIT = U.UNIT_CODE

AND S.ITEM_ID = :ITEM_DETAIL.ITEM_ID ;

SELECT TRUNC(QUANTITY/V_MAX_FACTOR) , MOD(QUANTITY,V_MAX_FACTOR)

INTO :ITEM_DETAIL.PACKETS_QTY , :ITEM_DETAIL.MIN_UNIT_QTY

FROM ITEM_DETAIL

WHERE SERIAL = :ITEM_DETAIL.SERIAL ;

--SET_RECORD_PROPERTY(:SYSTEM.TRIGGER_RECORD, :SYSTEM.TRIGGER_BLOCK , STATUS , QUERY_STATUS) ;

END ;

when i run the form and MESSAGE the record status , i get " CHANGED " when i in the form of this thread i get " QUERY " !!

What should i get again ? CHANGED OR QUERY ? why one of my forms returns CHANGED and the other returns QUERY ? !!

HamidHelal

salute-Salem wrote:

Oh Neveen , you opened the thread again ,

the link says that the record status is changed , and did not say the " Validation Status " , and i really do not know what is happening !!

i have another form which has a db-block with non-db items which get their data in this post-query trigger

  1. DECLARE 
  2.     V_MAX_FACTOR NUMBER ; 
  3. BEGIN 
  4.  
  5. SELECT S.ITEM_ENG_NAME , S.ITEM_ARABIC_NAME , S.MAX_TO_MIN_FACTOR , U.UNIT_NAME 
  6. INTO :ITEM_DETAIL.ITEM_ENG_NAME , :ITEM_DETAIL.ITEM_ARABIC_NAME ,V_MAX_FACTOR ,:ITEM_DETAIL.MIN_UNIT_NAME 
  7. FROM STOCK S , UNITS U 
  8. WHERE S.MIN_UNIT = U.UNIT_CODE 
  9. AND S.ITEM_ID = :ITEM_DETAIL.ITEM_ID ; 
  10.  
  11. SELECT TRUNC(QUANTITY/V_MAX_FACTOR) , MOD(QUANTITY,V_MAX_FACTOR) 
  12. INTO :ITEM_DETAIL.PACKETS_QTY , :ITEM_DETAIL.MIN_UNIT_QTY 
  13. FROM ITEM_DETAIL 
  14. WHERE SERIAL = :ITEM_DETAIL.SERIAL ; 
  15.  
  16.  
  17.  
  18. --SET_RECORD_PROPERTY(:SYSTEM.TRIGGER_RECORD, :SYSTEM.TRIGGER_BLOCK , STATUS , QUERY_STATUS) ; 
  19.  
  20. END


when i run the form and MESSAGE the record status , i get " CHANGED " when i in the form of this thread i get " QUERY " !!

What should i get again ? CHANGED OR QUERY ? why one of my forms returns CHANGED and the other returns QUERY ? !!

posted query must show as record status changed

for

SELECT TRUNC(QUANTITY/V_MAX_FACTOR) , MOD(QUANTITY,V_MAX_FACTOR) 

INTO :ITEM_DETAIL.PACKETS_QTY , :ITEM_DETAIL.MIN_UNIT_QTY  

FROM ITEM_DETAIL  

WHERE SERIAL = :ITEM_DETAIL.SERIAL ;

block the code / off the code

and you will see QUERY as status.

Hope so,

Hamid

Never use such conditions


WHERE S.MIN_UNIT = U.UNIT_CODE 

But always use the following relation

AND S.ITEM_ID = :ITEM_DETAIL.ITEM_ID ; 

There are many reasons for such a message...

May be you have one or more useless trigger in that form pls check them and remove if unnecessary.

Amatu Allah.

Eslam_Elbyaly

posted query must show as record status changed

for

  1. SELECT TRUNC(QUANTITY/V_MAX_FACTOR) , MOD(QUANTITY,V_MAX_FACTOR)   
  2. INTO :ITEM_DETAIL.PACKETS_QTY , :ITEM_DETAIL.MIN_UNIT_QTY    
  3. FROM ITEM_DETAIL    
  4. WHERE SERIAL = :ITEM_DETAIL.SERIAL ; 

block the code / off the code

and you will see QUERY as status.

Understood nothing Hamid .

Never use such conditions


WHERE S.MIN_UNIT = U.UNIT_CODE 

But always use the following relation

AND S.ITEM_ID = :ITEM_DETAIL.ITEM_ID ; 

how ? this will generate a cartesian , i have to join the two tables .

There are many reasons for such a message...

May be you have one or more useless trigger in that form pls check them and remove if unnecessary.

i do not have other triggers in the form .

- the link you provided says " the record status is CHANGED " , does it mean the " transaction status " or "validation status " ?

- what is your opinion ? what status does change ? transaction or validation ?

HamidHelal

I gave you an test and you don't post the result !!!

Hamid

1 - 23
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 26 2015
Added on Jun 23 2015
23 comments
19,009 views