8 Replies Latest reply on Apr 29, 2015 7:26 AM by philmodjunk

    Find routine gives wrong result when used in a popover

    Stu412

      Title

      Find routine gives wrong result when used in a popover

      Post

      Hi there

      I have a DB set up which shows companies and contacts.  I have a search routine on the company layout which lets you find a company by clicking a popover, entering a search string into a global field which is in turn passed to Enter Find Mode in a script to get the required record.  This works fine.

      I'm looking to do the same for contacts.  When I merely place the global field directly on the contact layout with a script trigger On Exit to run the equivalent search script, it runs perfectly.

      When I create a popover and drag the global field into the popover, instead of going to the contact record, the search results brings you to the COMPANY for which the contact works.  That's odd.

      I *think* it may have something to do with object naming but given I've just created a new global field and new popover on the contact layout, I cannot see where FM is getting the instruction to goto the company layout.

      If I place the global field on the layout with 'Move to next object' all ticked for Tab, Enter and Return, it takes me to the Company layout.  If I run the find script using a button I've created, it takes me to the correct contact layout.  

      I've had issues with object names before (when copy pasting a named object, FM didn't respect the fact that I renamed the pasted instance).  Is this something like that??

      Most vexed, any ideas would be appreciated.

      Thanks

       

        • 1. Re: Find routine gives wrong result when used in a popover
          philmodjunk

          My crystal ball is on the fritz again. wink

          I can't see your script and thus don't know how you set up your script to find records nor what role an object name might play in such a script.

               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 New 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.
          • 2. Re: Find routine gives wrong result when used in a popover
            Stu412

            Hopefully this should clarify the crystal smiley It seems ok..........

             

            • 3. Re: Find routine gives wrong result when used in a popover
              Stu412

              Hopefully this should clarify the crystal smiley It seems ok..........

               

              • 4. Re: Find routine gives wrong result when used in a popover
                philmodjunk

                Presumably, you have global storage specified for "contactquickfind".

                Object names will have nothing to do with this script. You can name objects on your layout or not and it will have no effect on how this script runs.

                My guess is that this script is not the script that is producing the results that you report. Either you are actually performing a different script by mistake or there is a script trigger being tripped that performs some other script that interferes with this one. (When a script trips a script trigger the current script is paused, the triggered script performs and then paused script starts up again--unless a halt script in the triggered script halts everything.)

                If you have FileMaker Advanced, enable the script debugger, then perform your find via the popover and watch what happens in the script debugger to see if a different script appears at any point in the process.

                • 5. Re: Find routine gives wrong result when used in a popover
                  Stu412

                  OK, so the bugs in the forum are double posting again by the looks of things...

                   

                  More importantly, I just cleared the tab order on both the Company and Contact layouts and now both searches are behaving fine.

                  Why would a tab order affect things in this way?  It's almost like 'On Exit' goto next object and don't worry if it's on another layout?

                   

                  • 6. Re: Find routine gives wrong result when used in a popover
                    philmodjunk

                    Sounds like you have a script trigger that is being tripped. When you change the tab order, you change what fields gain or lose the focus when this script runs and this then can change what script trigger such as OnObjectExit or OnObjectEnter gets tripped to run a different script.

                    • 7. Re: Find routine gives wrong result when used in a popover
                      Stu412

                      I do have an OnObjectExit script which fires when you click away from the popover search.  This is a simple GotoObject 'ContactSearch', where the object in question is the search field you're just in.  

                      However, that field itself was copy/pasted from the company search routine and renamed - I don't know if that's my mistake and I should have created everything from scratch on the contact layout.

                      At least I know where to look now and start getting to the bottom of it.

                      Thanks

                       

                      • 8. Re: Find routine gives wrong result when used in a popover
                        philmodjunk

                        That does not sound like the script that is causing the problem nor one that really makes sense in this context. It would seem to trap you forever in that one field. Since that is clearly not the case, there must be details to this which I cannot see. But that script could be tripping other triggers when it is performed--producing a chain.

                        This is a case where FileMaker Advanced can quickly resolve the issue by enabling you to step through the script and watch what happens one step at a time with any trigger performed scripts popping up into the debugger.