1 Reply Latest reply on Mar 14, 2011 3:09 PM by philmodjunk

    Portal stops updating normally after a record is added or deleted

    wladdy

      Title

      Portal stops updating normally after a record is added or deleted

      Post

      I have a database with three tables: 'Days', 'Shows' to record performances given on various days and 'Acts' to record the various acts making up each performance. There is a one-to-many relationship from Days to Shows and another one-to-many relationship from Shows to Acts.

      With helpful advice from members of this forum, I built a single layout from which to create new and navigate existing Shows and Acts. This master layout shows the records from ‘Days’. It includes portal A showing related record from ‘Shows’ and portal B showing related records from ‘Acts’. In order for portal B to display the contents of any given how selected in portal A, I

      1)   created in ‘Shows’ a Global Field,

      2)   created a script to populate this Global Field with the Primary Key of the show selected in portal A

      3)   created a relationship between between this Global Field and the Foreign Key in ‘Acts’

      This system was suggested to me by PhilModJunk (Portals with children next to portals whith grandchildren). It work well as far as navigation is concerned: I can move around the Shows in portal A and the Acts in portal B are immediately updated.

      However, the system stops working as soon as I enter or delete data in portal B. After I add or remove a record in B, when I return to portal A and select a new Show, the records displayed in B do not reflect the change. B goes back to normal updating if I select another Day (ie: another record in the master layout) or if I move to Layout view and then return to Browse view.

      My script to populate the Global Field in Shows is not as fault, as Global Field gets properly updated as I navigate in portal A. Rather, it seems that Portal B just stops respecting the Shows-to-Acts relationship after a record has been added or deleted in portal B.

      A peculiar feature of this anomaly is that when I browse through the records in A, in can still add new records to B, which will be linked to the proper record selected in A, as expected. Only, the other records in B do not disappear from view as they should and I end up in B with Acts having a Foreign Key different to the Global Field currently selected – a gross violation of the rules of the portal.

      Any help to solve this mystery would be greatly welcome.  W.

        • 1. Re: Portal stops updating normally after a record is added or deleted
          philmodjunk

          It's not really a "gross violation" it's just doing what you told it to do instead of what you want it to do. Wink

          Is this your relationship between Shows and Acts?

          Shows::ShowID = Acts::ShowID AND
          Shows::gSelectedShow = Acts::ShowID

          If so, the first pair of fields is controlling which value is entered into Acts::ShowID, not the global field and that will be the first record in your Shows Portal.

          Define the global field in Days instead of Shows and use these relationships:

          Days::DayID = Shows::DayID

          Days::gSelectedShow = Acts::ShowID

          Now, "Allow creation..." for Days to Acts on the Acts side should auto-enter the currently selected ShowID.