8 Replies Latest reply on Apr 17, 2015 3:23 PM by schpa

    Go to Field Script Step not working

    schpa

      Title

      Go to Field Script Step not working

      Post

      Hey!

      So I'm creating a database for my little company where the main user will be dealing with orders, stock status etc, and one of the most important features I want for this database is ease of use, generally just smoothness where you can go through everything with as little mouse-clicks as possible, most script steps that opens, performs calculations etc has a "Go to Field" script step at the end to the most logical next field.

      But for some reason, this exact field will NOT let it self be automatically entered.

      I've tried everything from Exit Script ; Result:False to prevent the KeyTrigger which fired the step to go to the next field, I've tried setting it as the next tab order and set the script to go to next field, which admittedly did work, but as the field is in a portal row and I want this script to always enter this specific field in the last portal row, this brings nothing. I've tried deleting the field and creating a new one with the exact same name, thinking that the FileMaker database file might have messed up the code or whatever to identify the field, but this didn't change a thing.

      It's driving me mad and I have no idea what to do next.

      This is how the end of the script looks. I'm not going to link the whole script as it's kind of long and it also kind of long and also contains a Perform Script script step which then also would have to be linked, besides, if I perform the exact same script steps, just with another field, it works.
      So here it is ;

      ...

      Perform Script ["Open Produktionpopover and Set Fade Global Variable"]
      Commit Records/Requests []
      Refresh Window []
      Set Variable [$$script; Value ""]
      Go to Field [Produktion::ProdBez]
      Go to Portal Row [Select; Last]
      Go to Field [Produktion::ArbeitTyp]
      Exit Script [Result:False]

      Any ideas/suggestions would of course be greatly appreciated!

      Simen

       

        • 1. Re: Go to Field Script Step not working
          philmodjunk

          It would be wise to use the Name box in the Inspector to give your portal an object name. Go to Portal Row does not specify the portal and acts on whichever portal a) has the focus or b) if no portal has the focus whichever portal is first in the tab order. You would then go to the portal row first, then go to the field in that portal row.

          So these four steps should be in your script in this order:

          Go to Object
          Go to Portal row
          Go to field
          Exit Script [false]

          • 2. Re: Go to Field Script Step not working
            schpa

            I had actually tried that, to no avail, and I tried again to be sure, nothing. BUT, what DID work was doing

            Go to Object
            Go to Portal Row
            Go to Object
            Exit Script [Result:False]

            My idea was that there was another version of that field hiding somewhere between layout objects that I couldn't find that it would go to instead, which is why I deleted and created a new one, to make that one dissappear.

            That field still will not let itself intered with Go to Field which is very strange indeed, but oh well, go to object does the same thing here so I'm happy :)

            Thanks for the suggestion Phil!

            • 3. Re: Go to Field Script Step not working
              philmodjunk

              If you have FileMaker Advanced, it might be enlightening to run this script and the original version in the debugger so that you can watch and see what get's the focus and when.

              • 4. Re: Go to Field Script Step not working
                schpa

                Yea, I always do that back and forth with problems like these, it opened the popover with the Perform Script step as intended, went absolutely nowhere with the Go to Field step, to the last Portal Row, and then nowhere again.

                What I forgot to mention, that also fired my suspicion that FIleMaker had got the codes wrong, is that earlier, for no apparent reason, it went to a whole nother field than intended with the Go to Field. Something like this:

                Go to Field [Table::Worker]
                Go to Portal Row [Select; Last]
                Go to Field [Table::Address]
                Exit Script |Result; False]

                And then it went to the field Table::Phone Number O.o and it wasn't even in the tab order this field.
                When I deleted this field from the layout, it seemed like it didn't have any idea where to go, so it just went nowhere from there on. I don't know much about coding, no earlier experience or education, but it to smells like some wrong codes where FileMaker recognizes the wrong fields for who they really are.

                What I fear is that I've somehow messed up the file by copying and pasting the .fmp12 file too much or something as this isn't the first time I've experienced strange these like this.
                Sometimes, also for no apparent reason, it just decides to behave like there's a modal window open, making me unable to do practically anything in the file until I click somewhere outside of the program, like on the desktop, and into FIleMaker again. Then, suddenly it decides to work properly again. This rarely happens anymore, and as far as I can tell, usually/only when I interrupt scripts gone wrong, like scripts stuck in a loop, even though this script hasn't opened a modal window or anything. Really baffles my mind, but as long as it just occurs when you interrupt scripts, which you won't do in the end product, it shouldn't be a problem, but I am worried that I have made such a fatal error to the file somehow that I will have to start all over again, as I've come quite far.

                • 5. Re: Go to Field Script Step not working
                  philmodjunk

                  It is possible that your layout is damaged and this is why the script is failing to put the focus where it should. I saw this happen one back when FileMaker 10 was the latest version and I about went crazy until I deleted the layout and started over.

                  • 6. Re: Go to Field Script Step not working
                    schpa

                    Ahh, interesting, I'll have to look into that if these problems persists. Would it in that case suffice to just copy all the objects in the layout, paste those objects into the same layout again and re-arrange scripts, layout script triggers etc. to make it exactly how it was before, or would I have to start from scratch and build everything from ground up again, meaning adding all field preferences, conditional formattings and what have you manually?

                    This is the main layout I'm talking about, which is packed with functions, I'd hate to build most of that up again.

                    • 7. Re: Go to Field Script Step not working
                      philmodjunk

                      Unfortunately, we can't see what is broken. For all we know, two of the layout objects have some sort of non-unique ID or other such problem. Thus, if we copy/paste from the problem layout to the new layout, there is some small chance that we have copy/pasted the trouble along with the layout objects.

                      • 8. Re: Go to Field Script Step not working
                        schpa

                        True. I'll just leave it as it is for now then, that layout is more or less done now and I've never had any other problems with it before other than the "modal window problem", which I haven't experienced in quite a while anyway.

                        Anyway, thanks for your help, gained some insight which can prove very useful.