Skip navigation
All Places > Discussions > Discussions
Log in to create and rate content, and to follow, bookmark, and share content with other members. Not a member? Join Now!
AnsweredAssumed Answered

Why do I see a grandchild record but with a blank child?

Question asked by on Jan 14, 2014
Latest reply on Jan 19, 2014 by philmodjunk


Why do I see a grandchild record but with a blank child?


     After I have created a new Parent record and then go to create a new child record and commit it, I then need to go the next portal along and create a related grandchild record.

               No problem, that all works, and the relationships are ok or so I thought.
               But when I 'Next' through the child records in the Child portal and then when it hits the last Child record (for that Parent) the portal blanks, BUT the Grandchild portal still shows the record that related to the last Child record (in the Child Portal.)
               What do I need to do to end at the last Child record (with its corresponding Grandhild record) ? It's as if it needs railway type buffers to stop the process at both ends (Next/ Previous and First / Last)



    • philmodjunk

           You'll need to describe your layout and database design in more detail. I can't tell exactly what you are doing when you "'Next' through the child records." Nor how exactly you set up a "grandchild portal".

           If you have these relationships:


           A portal to GrandChild placed on the parent record will show all grandChild records linked to any one of the Parent's Child records. Often this requires setting up a pair of "master-detail" portals where clicking a button in the Child portal updates a portal to show only the grandChild records linked to that one Child record. This approach, however, requires a different relationship than that which I've just posted.



             My layout is not complex and is based on CUSTOMERS-----<BOOKINGS------<ADVERTS.

             i also have:  




             The relationships between CUSTOMERS-----<BOOKINGS------<ADVERTS allow cascading creation and deletion of records from CUSTOMERS - BOOKINGS - ADVERTS in that direction only.

             I have planned it so users can do everything on one layout.

             My conundrum is this:


             I have located the Customer (or created new) 

             I see existing Booking in the BOOKINGS portal

             I see related Adverts in the ADVERTS portal

             I can create a new booking and then its related advert.  (same Customer)

             But if I then create another booking (same Customer) the advert associated with the booking I made earlier still shows. How can I get the ADVERT portal to clear, when I click the new booking button on the BOOKING portal?

        • philmodjunk

               There's a basic problem with your design.

               You have customers-----<Bookings-----<Adverts

               with "allow creation..." enabled for the child records in each relationship. You have portals to Bookings to Adverts on the customers layout. (In the following, I am assuming the the portals are unsorted and unfiltered.)

               But as I stated in my first post, the portal to Adverts shows ALL related Adverts for ALL related Bookings records. No part of this design enables you to link any Advert to a specific record in Bookings nor limit the list to just the Adverts for a specific booking.

               Instead, any new record that you create in the Adverts portal will automatically be linked to the first Bookings record shown in the bookings portal. There is no way just by entering data into the add row of the portal to link it to a specific Bookings record unless you have placed the kf_booking_id field in the portal row and formatted it as a drop down list or pop up menu for selecting which booking record is to be its parent record.

               I suggest that you examine this thread on "master detail" portals for a way to limit the Advert Records shown to just those for a specific record selected in the Bookings portal: Need layout solution for nested portals...



                 Many thanks.  The moral here is don't skip through the manual so quickly.  I need to study it more.

                 Incidentally my portals are sorted on the primary keys.


            • philmodjunk

                   That only affects how I explained this not how it works on your layout. With an unsorted portal, the "first" related records is also the first record listed in the portal. Since you are sorting the portal, the first related record may not be the first record listed in the Bookings portal so you may find that your current design is linking all Advert records to a different related record in Bookings.



                     Well, after all that it STILL doesn't work.  I just don't get it.

                     I now have a SelectedChild field in Parent table and it is linked to the additional TO SelectedGrandChildren

                     I have both create and delete set in the relationship.

                     But I still see a Grandchild record in that portal which is not related to the correct record in the Child portal.

                     It is going to be the most obvious error I know, but I am now blind to it.

                     Any clue?


                • philmodjunk

                       But on which portal did you base the grand child portal?

                       Is this a blank portal row that you see? if "allow creation..." is enabled for the relationship, this is a normal and expected result. That "blank record" is the "add row" where you create a new record in the portal by entering data into it.


                         The Grandchild portal is 'Show related records from SELECTED GRANDCHILD'

                         The fields in the Grandchild portal are from the SELECTED GRANDCHILD table occurrence


                         Yes I know the blank row is the add row. 

                      /files/7a7ec828ec/Screen_Shot_2014-01-18_at_04.46.06.png 926x692
                      • philmodjunk

                             What you describe is not actually possible. Unless the value in SelectedChild exactly matches the value of _kf_booking_id, the record cannot appear in the portal. I suggest double checking the value of those two fields if you see such a record appear. Your earlier design very easily could have created any number of ADVERT records that were linked to the wrong Bookings records.

                             And if the fields inside the detail portal row are not from the Selected Adverts table occurrence, you may have the illusion that you are seeing data from an unrelated record. Click each Adverts field in the portal and use "display data from" in the Inspector's data tab to make sure that you see: Selected Adverts::FieldName and not Adverts::FieldName.


                               The fields inside the detail portal row are from the Selected Adverts TO.  There are also a few fields from CUSTOMERS & BOOKINGS just for my information.  There are also fields from the linked ancilliary tables such as SIZE, POSITIONS, FEATURES, RATES, PARAMETERS (or their Joins.)

                               Below, I show it in layout mode and in browse mode. You see that the customer relates to the booking but the advert shown is from a previous booking.  It stayed there when I clicked the create new Booking button.  If I scroll down to what I woud have expected to be a blank detail row it actually has the previous booking id

                               As you will see below the Relationships graph shows that the  relationship from CUSTOMERS::selectedChild to the new SELECTED ADVERTS TO is many to many.  Is that where it's going wrong perhaps?


                            /files/ed1961b6db/layout_mode2.jpg 1090x836
                              /files/9906cdc161/Browse_mode.jpg 1100x850
                              • philmodjunk

                                     What I see seems to show the the relationships are working correctly. The Values in SelectedChild and kp_bookings match as they should in the screen shot of the Advert(s) tab. Since this value is not the same as the value of the Bookings ID in the Bookings portal suggests that your script is not successfully updating selected child to the correct value.