7 Replies Latest reply on Jan 28, 2016 10:28 PM by synergy46

    FM 14 Adv Go To Portal Row on New Record

    synergy46

      NavPortal.png

      I have a Members table.  It is self joined with a portal (on the left; blue and gray) name MembersPortal.

      The nav systems use gtrr to show the selected record on the right.  It works great.

       

      script343.png

       

      The problem is:  If I add a new record (let's say it has a last name of Wilson, when I exit the last name field, Wilson's record is put at the bottom of the MembersPortal portal list and is not visible. (that is probably because the portal sorts on that field)    I have tried:  get(activeportalrow) (which strangely shows 0) along with  go to portal row.  I have tried $$MemPKid=Member::PK_id with a find (which works) but I CAN NOT GET THE @*&^#^$# MembersPortal to scroll down and show Wilsons record.    I know I can use some Brian Dunning functions to show the top and bottom visible portal rows but isn't there a FileMaker way to do this?  It seems like I have tried everything.   thanks

        • 1. Re: FM 14 Adv Go To Portal Row on New Record
          mikebeargie

          Get(ActivePortalRowNumber)

          Documentation states that the function returns zero when no portal is selected.

           

          Try moving line 10 (go to object) down AFTER your find. Although line 13 (show all) negates your find in line 12, so not sure what you're trying to do there.

           

          Basically by performing a find or showing all records, you are unselecting the portal, so nothing else you're trying to do evaluates properly. Moving line 10 down to line 14 should make some of it work.

           

          Also, line 20 shouldn't be there. If you're trying to save (commit) the record, you should be doing that before you do anything you have written in the rest of this script.

          • 2. Re: FM 14 Adv Go To Portal Row on New Record
            synergy46

            Hi Mike,

            What I am after, (and I understand why you don't understand by looking at my code) is to move the portal scroll bar down so that the current record is revealed.  (This is what I was trying to do with the FIND and  GOTO PORTALRow etc...).

             

            The "X" portal (TOC of Members named MembersPortal) has hundreds of records.  When I enter a new record and enter the last name, some code runs which has a COMMIT RECORD in it., So, if the last name is WILSON, for example, that new record will fall near the bottom and out of sight of the portal.  All I want is for the portal scroll bar to move down along with the insertion of the new, WILSON record so that Wilson is visible.

             

            Move Go To OBJECT AFTER the find?  If I am  trying to find the PK in MembersPortal, don't I need to GO TO OBJECT first and then FIND on the MEMBERSPORTAL table.  Otherwise I am finding on MEMBERS....?

             

            The use of SHOW all is my 'lame' attempt to, after a successful find and to avoid 1 of 1 records found, to show ALL records with target record highlighted.

             

            Thanks for the reply.

            • 3. Re: FM 14 Adv Go To Portal Row on New Record
              mikebeargie

              no, a perform find script step is always performed outside of the portal.

               

              What you probably need to do is:

              Set Variable [ $matchingkey ; the key you are looking for ]

              Go To Object (portal)

              Go To Portal Row [ first ]

              Loop

                 Exit Loop If [ table::primaryKey = $matchingkey ]

                 Go To Portal Row [ Next ; exit after last ] //exit after last if no match

              End Loop

              You might need to scrap a large portion of that script and start over using this method.

              • 4. Re: FM 14 Adv Go To Portal Row on New Record
                synergy46

                Hi Mike,

                Yes, looping is the answer.  But... I can't get $PortalRow to return the selected get(activePortalRowNumber)....

                 

                Ideas..??

                 

                Thanks

                 

                RON

                 

                FindNameInMemberPortal.png

                • 5. Re: FM 14 Adv Go To Portal Row on New Record
                  mikebeargie

                  you're still doing kind of bizarre stuff in your script.

                   

                  Lines 10/12/14 are not needed, move line 13 above line 11 and it will work exactly the same way.

                   

                  Why the commits on lines 3 & 7? you're not editing data at all here?

                   

                  Lines 16-19 undo what you just did inside of the loop. no reason for them.

                   

                  Line 6 should be above line 4.

                   

                  If you want to get the active portal number from what you found in the loop, then line 5 has to be AFTER the loop is complete. But since you're already navigating to the portal row inside of the loop, there is no reason to use any of your $portalrow steps.

                   

                  Where you have it now, $portalrow is probably returning zero, because you've gone to the portal itself, but not any row in the portal. If you place line 5 after line 8, then it will return 1. If you put it inside the loop, then it should increment up with each row number, 2,3,4,5 etc...

                   

                  Do you have script debugger and data viewer open so you can run this script and step through it to see how these variables evaluate, and how these script steps work?

                  • 6. Re: FM 14 Adv Go To Portal Row on New Record
                    siplus

                    Why do you want the portal to go to the record you just inserted ? As a confirmation of the fact that it's there ?

                     

                    btw,

                     

                     

                    cannot_be_unseen.jpg

                    • 7. Re: FM 14 Adv Go To Portal Row on New Record
                      synergy46

                      Hi Mike,

                      I got it to work.  Just used your looping routine and put it in a script that was called whenever I had to add, delete or navigate a record. 

                       

                      I was thinking that there would be some FM setting, or function that I could invoke that would move the portal scroll bar; but there apparently is not.  Maybe in FM 15...

                       

                      Thanks for all the help.

                       

                      Ron