10 Replies Latest reply on May 31, 2011 6:28 PM by LaRetta_1

    Startup Script Getting Frozen



      Startup Script Getting Frozen


      I have a script that runs when file maker is opened, however it sometimes gives me a "thinking" cursor and nothing happens for minutes (resulting in my closing file maker and opening it again) or what I wanted to see appears straight away. Is this because my start up script is too chunky? Is there some way I can ensure that I don't get this happening? 



        • 1. Re: Startup Script Getting Frozen

          We'd need to see your start up script.

          1. You can upload a screen shot by clicking the edit link to your original message and uploading it there
          2. You can upload a screen shot to a file share site and post the download link to a new response you post here.
          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.
          4. If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
          • 2. Re: Startup Script Getting Frozen

            screenshot added

            • 3. Re: Startup Script Getting Frozen

              Nothing jumps out as a possible culprit, there are simpler ways to clear the fields in your table without using a loop, but what you have should work and shouldn't get trapped in an infinite loop. Also make sure that your script always executes from the same layout. Since the first step of the script does not use go to layout to specify a layout, this script might be executing from different layouts depending on what layout was selected the last time the file was closed (or closed on the host for multi-user files.)

              your script calls another script:

              Perform Script ["Big Query v7"]

              And I have no idea what that script does. The cause of this problem could be contained in that script.

              • 4. Re: Startup Script Getting Frozen

                Hm... I've changed a few things and the script, a switch to layout in the script rather than the file options. and some setting of defaults that does not call various nested scripts

                It seems to freeze less often, but still seems to happen. I removed the line Perform Script ["Big Query v7"] (it was put in as a patch for another problem that seems to have been resolved by cleaning up my script). I opened and closed the file a few times and it freezes about one in every three times, could this be related to the computing power of my computer...

                I may try and make my #set select to None section more efficient later, but for now I might focus on building the other parts of my project. 

                Thanks for your help!

                • 5. Re: Startup Script Getting Frozen

                  You have another post about the Big Query script. Does that indicate that you now think the issue is related to the privilege set problems you are dealing with there or do you think that is a different issue?

                  Since you are getting the hourglass, your "freeze" could indicate either an infinite loop in your script or a process such as a find or sort that's dealing with creating an index for a very large number of records and thus is taking a very long time to complete.

                  It's also possible that you have a damaged file or a file with a bad index.

                  To rebuild the index of a single field:

                  1. Open Manage | Database | Fields and double click the field
                  2. Use either the storage tab or the storage options button to turn off indexing.
                  3. Exit Manage | Database, then return and turn indexing back on.


                  You can also rebuild all your file's indexes by importing all the data into an empty copy (clone) of your file.

                  It's also possible that you have a damaged file or a file with a bad index.

                  If you have FileMaker 11, you can use Advanced Recovery options to rebuild your file's indexes:

                  1. With the file closed, select Recover from the File Menu.
                  2. Select "Use advanced Options"
                  3. Select only: "Copy File Blocks as-is" and "Rebuild Field Indexes Now".


                  To check for damage, try recovering the file.

                  Things to keep in mind about Recover:

                  1. Recover does not detect all problems
                  2. Recover doesn't always fix all problems correctly
                  3. Best Practice is to never put a recovered copy back into regular use or development. Instead, replace the damaged file with an undamaged back up copy if this is at all possible. You may have to save a clone of the back up copy and import all data from your recovered copy to get a working copy with the most up to date information possible.
                  • 6. Re: Startup Script Getting Frozen

                    Are your "search variables" all global fields?  I can't tell from their names (usually, I append global fields names with a g character to ID them as global fields, so would name the first field gSpicySearch, etc. -- makes them easier to identify).

                    Dispense with the loop setting the dishFISH_database::selected field.  Just Show All Records, go to First, Setfield the value to "" and then Replace throughout with current field contents.  Much better than looping (IMHO), especially if you have a lot of records.  Why loop if a single command will take care of it for you?

                    What's the Perform Find (below the Big Query v7 line)?  Might it return a LastError=401 ("No records match the request").  You need to add a first step to your script (Set Error Capture On) in order to allow for that possibility.  

                    Looks like you are trying to set the gVar $$error_message to nothing ("") based on getting a last error of some sort, but you don't delineate what that last error is supposed to be.

                    That's all I can see of the script.  Is there more going on after the final End If shown in the screen grab?

                    - shud

                    • 7. Re: Startup Script Getting Frozen

                      Ah brilliant, I did not know that that was what the "replace field contents" script did! I only did the loop because I could think of no better way. It has certainly made the startup more smooth by removing the loop. 

                      also the Big Query is no longer part of the startup script. and I intented for the error_message to be set to nothing since I want my default screen to be empty of any previous interaction. is there a better way to set the found set to nothing, since at the moment I am just running a find on a string of gibberish. 

                      • 8. Re: Startup Script Getting Frozen

                        >> ...is there a better way to set the found set to nothing

                        If I understand you correctly, you want zero records to show in your interface as you open your system.  Do a Show All Records, followed immediately by a Show Omitted Only.  The first step insures you get all the records, of course, and the second puts them all into the background, showing you zero records, thus a blank screen.  Is that what you want?

                        Running your find on a set of gibberish means having to add logic to the script (including capturing for errors, etc.) which is not necessary if you do the above.

                        Hope this helps.

                        - shud

                        • 9. Re: Startup Script Getting Frozen

                          The above method can sometimes result in a newly created record appearing instead of a found set of zero. It takes split second timing but isn't at all impossible if you have more than one user accessing the file at the same time. If another user creates a new record after the Show All records, but before the Show Omitted Only, that newly created record will appear. (And thanks to LaRetta for pointing out that limitation to the above method to me in a previous post.)

                          A script that finds nothing with set error capture enabled to supress the records not found dialog will not have this limitation.

                          If you have an auto-entered serial number field, you might perform a find for a negative number in this field:

                          Enter find mode [] // clear pause
                          Set field [Table::SerialNumberField ; -1 ]
                          Set Error Capture [on]
                          Perform Find []

                          • 10. Re: Startup Script Getting Frozen

                            I actually like that, Phil.  The discussion mentioned was a way of isolating ONE record (the record the User is on) without risk of another record having been created at the moment between Omit Muliple(all) and Show Omitted.  Just for those which might wish for this, you can loop (learned from JT Hughes aka -Queue- quite some time ago):

                            Freeze Window
                            Show All Records
                            Omit Record
                            Show Omitted Only
                            Exit Loop If [ Get ( FoundCount ) = 1
                            Go To Record/Request/Page [ Last ]
                            Omit Record
                            End Loop

                            This is a brilliant method of isolating one record when multiple Users are adding records. 

                            But back to the current issue of no records ... So you are saying that we should find something which couldn't possibly exist, adding Set Error Capture [ On ] before the find and therefore ending with 0 records.  However, for the purpose of learning/understanding, here is another method of isolation using the above scripted theory from JT:

                            Freeze Window
                            Show All Records
                            Show Omitted Only
                            Exit Loop If [ not Get ( FoundCount )
                            End Loop

                            I like yours better overall!!   Consider it stolen. Smile  I would worry that the item we are searching must truly not exist but I think you've come up with a perfect search item; i.e. -1 in the serial ID.  Laughing