This discussion is archived
7 Replies Latest reply: Nov 20, 2012 2:55 PM by 975322 RSS

How to join three or more blocks in a form (like master/detail)

975322 Newbie
Currently Being Moderated
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
  • 1. Re: How to join three or more blocks in a form (like master/detail)
    MLBrown Journeyer
    Currently Being Moderated
    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.
  • 2. Re: How to join three or more blocks in a form (like master/detail)
    Kumar_9985 Newbie
    Currently Being Moderated
    Hi,

    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. :)

    Thanks,
    Kumar
  • 3. Re: How to join three or more blocks in a form (like master/detail)
    975322 Newbie
    Currently Being Moderated
    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
  • 4. Re: How to join three or more blocks in a form (like master/detail)
    MLBrown Journeyer
    Currently Being Moderated
    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.
  • 5. Re: How to join three or more blocks in a form (like master/detail)
    975322 Newbie
    Currently Being Moderated
    But C is the parent of B, B takes FK from C and also A (B has two FK) and this is the problem if B was a parent it would be easy.
  • 6. Re: How to join three or more blocks in a form (like master/detail)
    MLBrown Journeyer
    Currently Being Moderated
    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.
  • 7. Re: How to join three or more blocks in a form (like master/detail)
    975322 Newbie
    Currently Being Moderated
    You've got it right.This is the assignment i've got and i can see in a jpg file, that goes with it, how the finished form looks like.
    It doesn't make sense.

    Thanks for your help

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points