Home » Developer & Programmer » Forms » Master-Detail Relationship in Oracle FORMS (Front end- Forms 6i,database- Oracle 10g)
Master-Detail Relationship in Oracle FORMS [message #449145] Sat, 27 March 2010 06:41 Go to next message
h_jitendras
Messages: 36
Registered: October 2006
Member
Hello everyone,
I'm designing a canvas which will open up on the click of a push-button from a form A. Now this form A has a data block(ie. single underlying table A).
I want to display data from two tables - Table B and Table C in this canvas in the form of a multi-record grid structure - one below the other i.e. table B data above and table C data below.

Now table B and table C share a PK-FK relnship between them.
What I want is when a user clicks on a record in the table B above then the corresponding records in the table C should get displayed below(now there can be multiple detail records in table C for a single record in table B - PK-FK reln)

i'd written code something like this in the When-button-pressed trigger:-

c_where_clause := ....(query from Form A)
set_block_property('block B',default,c_where_clause);
go_block('block B');
go_block('block C');
execute_query;
first_record;

(in addition to the above trigger, I have also included queries in the post-query trigger of the two tables B and C to get some data populated in the non-database fields in this canvas)

do i have to do add a piece of code to loop thru the records...
like checking for last record,if not going to the next_record and so on for both the blocks?

Please let me know if the above query is clear and if not please let me know how I can make it more clear?


Re: Master-Detail Relationship in Oracle FORMS [message #449199 is a reply to message #449145] Sat, 27 March 2010 13:14 Go to previous message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
What I want is when a user clicks on a record in the table B above then the corresponding records in the table C should get displayed below

This is Forms default behaviour - you don't have to do anything about it. Simply use data block wizard (twice - once to create master block, second time to create detail block). Wizard will create relationship automatically (if it is found in the database), or you'll join columns by yourself.

POST-QUERY trigger is OK - you have to populate non-database items after query is executed, and this is the right trigger to do that.

So - forget about unnecessary code you meant to use.
Previous Topic: Arabic Characters Problem??!
Next Topic: Splitting Oracle database into two
Goto Forum:
  


Current Time: Fri Dec 06 14:16:17 CST 2024