I have four data blocks for four tables, lets call them blocks A, B, C, D
Block A is a master block and block B is a detail block, block B holds a foreign key from block A (ofcourse)
Now when i choose in a query data from block A it lists also data from detail block that is corresponding, but now.....
detail block B also holds another foreign key from block C which takes his key from block D. and
i want to make a form that will, when i query master block A, show some data from block B, C and D that is
corresponding to block A.How do i do that?
i'm using 10g and i am a begginer
In each Data Block there are three nodes - triggers, items, and relations. The relations node is what you use to link the master to the detail. If you highlight the Relations node and press create a window will open to create your "New Relation". The master block is already entered because it is the block that you are currently in. You can then pick a detail block by pressing the "select..." button or just type the name of the block in. So if you did this in block A, you would enter B as your detail block. You will then need to enter a join condition. If the PK in block A is named A_DETAIL and the FK in block B is the same name, then you can just type in A_DETAIL, press OK, and the relationship will be automatically created. If the names are different then you could put in a join condition like A.A_DETAIL = B.B_A_DETAIL (whatever the names of the blocks and items are). You can then repeat this process for every parent-child relationship.
In the example you mentioned B is the child table of master tables A,C and C is the child table of D.
Now in the block properties of A create a relation with B by giving equi join.
Similarly in the B block create relation with C,D (if B has the foreign key of D) else create a similar relation between B and C, C and D.
Now if query master block A, show some data from block B, C and D that is corresponding to block A.
I hope this will work. :)
I joined every parent/child in master/detail relationship (again like I did before) and when I run the form and query A it only shows details from B, and details from C and D are empty.
So when I make master/detail relationship can I change it this time and make child-the master and parent-the details or something?
Thanks for ressponding so quickly
I think you are missing one of the relationships.
If A is a parent of B then you need to create a relationship in the A block where you join A to B.
Which is the next relationship?
It sounds like D is a parent of C so would have to create another relationship in the D block to join with C.
At this point you have A tied to B and you have D tied to C, but now you need to link them together. Which is the parent?
From what I could tell you need to link B to C, so if B is the parent then you would create a relationship in the B block to join to C.
Once they are all linked, when you query data into A, they should all trickle down and populate.
This is confusing. So if I have this right:
A and C are parents of B
D is a parent of C
If that is true, when you query data into A it will never be able to populate D and C because there is not a relationship between A, C, and D.