4 Replies Latest reply on Sep 10, 2012 2:48 PM by TurtleKoala

    Scope of finds in subscripts



      Scope of finds in subscripts


           I was wondering how to preserve a set that is found while another script is paused. I have a script that begins by performing a find, and then it checks how many records were found. If more than one record was found, then the script pauses and it has the user choose which record they want. The script then continues, but it does not recognize the new found set, but rather continues to perform as if only the original find had occurred. Is there some way to tell it to continue running with the new found set?

        • 1. Re: Scope of finds in subscripts

               We'll need to see the details of your script. See instructions at the end of this post for how to post your script here.

               If you open up manage | Database | Relationships, you'll see a bunch of "boxes" linked in relationships. Each of these "boxes" is called a table occurrence. We can't call them a table because more than one of these can refer to the same table. When it comes to a found set, each table occurrence has it's own current found set, current record and sort order for each window that you have open. If "continues to perform as if only the original find had occurred" is the case, then it would appear that you have either more than one window open or you are changing back and forth between layouts based on different table occurrences. (Each layout specifies a single table occurrence name in the "show records from" drop down found in Layout Setup...)

               When I do such a scripted find, I often list the found records in a scrollable list where each row in the list is a button. Clicking a button performs a script that uses the primary key of the clicked record to find that record on the layout I intend to use to display my selected record. This might be a useful alternative approach to your current set up.

               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.
          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.
          5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
          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. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)



          • 2. Re: Scope of finds in subscripts

                 I was trying to do something similar to what you described. When my script pauses, it takes the user to a different layout. That layout is a list where each entry is an employee record. Each record has a button that does

                 Show All Records

                 Omit Record

                 Show Omitted Records

                 and also resumes the paused script. The image shows the beginning of my script.

            • 3. Re: Scope of finds in subscripts

                   What you show should work in most cases though in a networked environment a newly created (by a different user) record can creep in between the omit and show all steps.

                   I'd look for a layout based script trigger such as OnRecordLoad or OnLayoutEnter (or exit) that is interfering with the results of your script. If you have FileMaker Advanced, use the script debugger to step through the script and that way you can see if a trigger performed scritp pops up and interferes. If you do not have advanced, you might be able to figure things out if  you insert some show Custom Dialogs steps to pause the script and display text that tells you where in the script you are when it is paused.

              • 4. Re: Scope of finds in subscripts

                     Thanks. I just found the problem by inserting Custom Dialogues. It was working correctly, but I had another find in one of my subscripts that came later in the code which was a left over from before I modularized the script.