1 Reply Latest reply on Sep 14, 2011 3:07 PM by philmodjunk

    Question: Keep a table and portal in sync (part 2)



      Question: Keep a table and portal in sync (part 2)



      This is a continuation of a previous post, but I had to make a new message as I could not insert a picture in the reply section of the original forum message. (I tried for three days on three computers with four different browsers.)

      I am still trying to get a Main table and a Portal to scroll in synch with each other.

      I have 1 table.

      I have 1 key field.

      I have self joined.

      The relationship uses the X operator.

      I have put the original table on a layout, I have put the selfjoin table in a portal on the layout.

      All I want is that they scroll in sync, and if I select a record in either, the related record shows in the other.

      I presume I must need a script, but I have actually tried every possible combination of scripts and events I can think of, but it just does not happen for me.

      Is life really this difficult, or is it me just not getting the point?

      I don't think I am totally stupid, I've raised 3 kids and held down a decent job for 30 years.

      So please could someone put me out of my misery and help me just get started with this.

      Thank you.



        • 1. Re: Question: Keep a table and portal in sync (part 2)

          To post an image to a reply, you can upload the image to a file sharing site and then post the link here. You can also use edit post to modify your original post to include a new image file. You may need to delele the original change, save the post, edit it again and upload the new image before others can see the new image--that's something we just recently figured out here.

          Please note that this is the first post where you have provided all the needed info, specifically the relationship used and that you want to scroll the portal to reveal the same record in the portal as is current on the layout.

          Go To Portal Row is a script step that you can use to scroll the portal. When using a script to interact with a portal like this, it's safest to use the name box at the top of the Inspector's position tab to give the portal an object name. Let's name it "AllStudentsPortal".

          This script will scroll the portal until the record shown on the layout is also visible in the portal. This can be fine tuned to position the record as near to the top as possible, but I'll leave that part up to you.

          Go to object ["AllStudentsPortal]
          Go to Portal Row [First]
            Exit Loop If [tblStudent::fldStudentID = tblStudentSelfJoin::fldStudentID]
            Go To Portal Row [next ; exit after last]
          End loop

          that's it.

          The 'exit after last' parameter shouldn't be needed, but including it ensures that if you make a mistake with the expression in Exit Loop, you won't get trapped inside an infinite loop.