6 Replies Latest reply on Jul 24, 2013 10:44 AM by philmodjunk

    Script Can't Exit Portal FM12

    JeffMillard

      Title

      Script Can't Exit Portal FM12

      Post

           While adding rows to a portal I determine based on the value in the last row that no more rows are likely to need to be entered. At this point I would like to exit the portal and jump to a field in the main layout.  While in debug and stepping thru my script that Goes to the object outside the portal I see that it does go there BUT THEN JUMPS RIGHT BACK INTO THE PORTAL ROW.  Can one escape the gravty of a portal?!?

        • 1. Re: Script Can't Exit Portal FM12
          schamblee

               As far as getting focus a portal is the same as any object.  The order that fields are enter, including fields in a portal, are based on the tab order.  I would guess this has to do with your script, which you didn't display. I assume you have a script tigger and something in your script is setting focus back into the field in your portal.

          • 2. Re: Script Can't Exit Portal FM12
            LaRetta_1

                 Actually, you might be greatly surprised to what is actually happening in regards to the order moving through objects (i.e. the stacking order).

            http://fmforums.com/forum/topic/89095-go-to-object-unexpected/

                 Object-name the fields you wish to land on ... it is the only way to truly escape the internal order of FM objects.

                 Take the time to review the very simple, 5-minute file.  It has caught even good Developers off guard.  Besides explaining issues like what you face, Jeff, it explains the true stacking order of objects on layouts. 

                 Without knowing your exact script (as S. Chamblee says),  I cannot say for sure, but the link provided will certainly save you headache down the road.  I see this issue repeated in all forums by many folks (seasoned developers and newbies alike) which is why I created the demo.

            • 3. Re: Script Can't Exit Portal FM12
              philmodjunk

                   It's also possible to create a script that trips its own script trigger and thus traps itself in an infinite loop. It's possible that all you need to do is end your script with the Exit Script [False] step, but that's just a guess on my part unless you share your script with us.

                   To post a script to the forum:

                     
              1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
              2.      
              3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
              4.      
              5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
              6.      
              7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
              • 4. Re: Script Can't Exit Portal FM12
                JeffMillard

                     To S. Chamblee's assumption, no the script merely ends with (momentarily) the focus set on the object outside the portal as I wish. I suspect based on LaRetta's reponse and demo (Thanks for that!) that FM does not forget the stacking/tab order it has planned regardless of where a script might send you. In my case the script trigger is an 'on exit' trigger which I suspect means that FM has already decided what the next object focus will be (no surprise there).  It is perfectly happy to let me go wherever I want in the space of my script when the trigger fires BUT, after I have had my fun it is gonna go to the 'original' next (stacking/tab) object it was going to as if I had no trigger or script involved. Probably inherent with 'on exit' right-- by definition you are in the space between one field and the next field in the tab/stacking order. Probably no command to tell FM hey-- cancel that take it from where I leave YOU. :-)  I will look for a better place to blast out of the portal.

                • 5. Re: Script Can't Exit Portal FM12
                  JeffMillard

                       SUCCESS!  I put the trigger OnENTERing the last object in the portal row so when the user tabs to it is already 'there'. My GotoObject works and the focus remains there (object outside the portal) and thus I can skip ahead in the stacking/tab order. So it really had nothing to do with being stuck in the portal but being in-between two object's focus-- on exit means that fm has already looked to where the next focus will be AND RESISTANCE IS FUTILE. (Hmmm... I wonder if I exit the app in an OnExit trigger if it can find its way to the next field as it wants?-- just want to know who is really running the show ;)

                  FM: "I must go to the next field in 'the order'

                  ME: "You will go where I tell you and stay there"

                  FM: "I cannot stay- I must return to 'the order;"

                  ME: "I can make you exit!"

                  FM: "I know you can...but will you?"

                        

                  • 6. Re: Script Can't Exit Portal FM12
                    philmodjunk

                         Take a look at "setting up script triggers" in FileMaker Help. Some script triggers result in FileMaker processing the triggering event before executing the trigger's script, others process the triggering event after the script finishes. This help entry has a table where you can see which triggers are which and as I suggested earlier:

                         Exit Script [False]

                         can be used to end your script and keep the triggering event from being processed IF the trigger is one of those that perform the script and then process the triggering event.