Oracle Forms 10g Validation on iten level - comparing detail to detail

anumoses
anumoses used Ask the Experts™
on
Block A (Master)  - Irradiation_hdr ( table) irradiation_id is key
 Header Block

Block B ( detail) - Irradiation_dtl ( table) product_id is key
multi record block

Product code     Unit No

E3056                W039708002607
E3057                W039708002721
E3058                W039708002754

Data is saved here in header and detail table.  



Block C multi record block ( is also detail )  Irradiation_dtl ( table) product_id is key
Now verification if data chosen resides in previous block ( B block)

Product Code  Unit No
E3058             W039708002754
E3056              W039708002721 -----------different than upper block data (has to              be            W039708002607
E3057              W039708002721

Has to validate with the data in upper block B and say wrong data when compared. Choose right data that is in
block B How can I do it on item level of Block C?

Thanks in advance.

Anu
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Naveen KumarProduction Manager / Application Support Manager

Commented:
i can tell you pseudocode kind of stuff because it's a while i did forms coding etc..

in the when validate item or when validate record of the block C.. do something like the below...

1) store the current record of the c block into variables...
2) go_block(..) ... first keep the cursor in the first record of the block b
3) compare with the variables in step1 and field values of 2)
    if mismatch give error as you wanted.
    else
       next_record(..)  -- move to next record in the block b and do the same as in step 3
4) now move down one record in block c and store them into variables and again do the same from step 1) untils all records are scanned or we reach end of the block.

Author

Commented:
I have to do validation on the item level of Block C and check  if the combination of Product and unit is there in Block B. Else give error message
Database Administrator
Commented:
If you just need to make sure that the data in block C matches the data in block B (for the current record in block B), that is very easy, and you don't have to do the complex coding that nav_kum_v suggested.

Oracle Forms, in master-detail forms, can easily refer directly to the values in a single master block record from validation triggers in the detail block.  Oracle Forms cannot refer directly to values in other records in the master block.  But, if you have well-normalized tables, the other master records don't matter anyway.

The simplest option is to not even display the foreign key values in the detail block.  Just have them be non-displayed items that automtically copy their values from the master block.  Then you don't have to worry about validating them at all.  If you do want the foreign key values though to be displayed (and changeable for some reason) in the detail block, your when-validate-item trigger in the detail block can simply compare :block_C.product_code to :block_B.product_code, and give an error if they are not equal.
Naveen KumarProduction Manager / Application Support Manager
Commented:
You got it right. Yes we can do that way.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial