10 Replies Latest reply on May 10, 2011 11:07 AM by Miguel

    Perform Find Script - Hourglass

    Miguel

      Title

      Perform Find Script - Hourglass

      Post

      Hi,

      I'm trying the following script:

      Go to Layout ["Consolidated_Report" (Projects_Table)]

      Enter Find Mode[]

      Set Field [Inventory::Ready_for_Processing; "YES"]

      Perform Find[]

      Set Error Capture[On]

      Show All Records

      The script works, but I get an hourglass with ESC flashing on the bottom indefinitely until I hit ESC.

      What am I doing wrong?

      Thanks for your support,

      -Miguel

        • 1. Re: Perform Find Script - Hourglass
          philmodjunk

          What is the relationship between Projects_Table and Inventory?

          And why is there Show All Records at the end?

          To perform a find and then immediately turn around and show all records without actually doing anything with the records you just found makes no sense here.

          Do you have objects on your layout such as conditional formats, summary fields, calculation fields with aggregate functions such as Sum() that access possibly very large numbers of related records?

          Best guess I can make from here, is that your layout has such objects and it's taking a while to update the layout due to the large numbers of records involved. Pressing escape terminates the update of one or more such calculations.

          If you remove "Show All Records", do you still get the hourglass?

          • 2. Re: Perform Find Script - Hourglass
            Miguel

            "What is the relationship between Projects_Table and Inventory?"

            It's the allow creation of records on both tables via this relationship using a PK and FK.

            "And why is there Show All Records at the end?"

            Because I searched the forum before I posted and that's one of the examples I saw Tongue out

            "Do you have objects on your layout such as conditional formats, summary fields, calculation fields with aggregate functions such as Sum() that access possibly very large numbers of related records?"

            No, this is a brand new table layout with no summaries, conditional formats, etc. Now, Projects_Table has almost 50000 records.

            "If you remove "Show All Records", do you still get the hourglass?"

            Yes Frown

            Now, this is very interesting, if I leave the script running without hitting ESC, it cycles through enter find mode, set field yes, and the results. 

            -Miguel

            • 3. Re: Perform Find Script - Hourglass
              philmodjunk

              What do you want this script to do?

              • 4. Re: Perform Find Script - Hourglass
                Miguel

                The script needs to go to the new layout and find all the ready_for_process records marked with yes. Later on I'll add it to a button, but that's another story Smile 

                -Miguel

                • 5. Re: Perform Find Script - Hourglass
                  philmodjunk

                  You need to remove show all records from your script as it defeats the purpose of this script.

                  You refer to two different tables in your script. Inventory and Projects_Table. Presumably, you want to find the records in the Projects_Table that have a related record in Inventory where the Ready_For_Processing field is "yes".

                  Is Ready_For_Processing a calculation field? If so, is it stored or unstored?

                  In any case, you need to remove show all records from your script as it defeats the purpose of this script here.

                  Once you make this change, how many records does this script find?

                  The fact that you are finding records where the criteria is entered into a related table's record does slow your find. Having 50,000 project records also slows this down. If it is an unstored calculation, it will really slow you down when working with large numbers of records like this. If this is an unstored calculation field, you may need to redesign things so that you can perform this find by entering criteria into a stored/indexed field instead of this unstored calculation field.

                  You might also try performing this find on the Inventory layout to find the inventory records, then use Go To Related records with the match found set option to then switch back to the Projects_Table layout. This trick works best if the find is only likely to pull up a fairly small number of inventory records. With large numbers of records found, it can be as slower or slower than your current script.

                  • 6. Re: Perform Find Script - Hourglass
                    Miguel

                    I removed show all records and Ready_For_Processing is not a calculation field. 

                    the script finds 2000 records, which is about right, regardless of how long I take to ESC from it.

                    I tried:

                    Go to Layout ["Details" (Inventory)]

                    Enter Find Mode []

                    Set Field [Inventory::Ready_for_Processing; "YES"]

                    Perform Find []

                    Go to related record [Show only related records; Match found set; From table: "Projects_Table"; Using Layout: "Consolidated Report" (Projects_Table)]

                    Go To Layout ["Consolidated Report" (Projects_Table)]

                    Same results; once I hit ESC it shows what I want.

                    Thanks for your help, PhilModJunk!!

                    -Miguel

                    • 7. Re: Perform Find Script - Hourglass
                      philmodjunk

                      Something in your layout is taking a long time to update. If it were the find, esc would interrupt the find and you wouldn't see the correct group of records. (Make sure you test this by starting with a found set different from the set you want to see ust to be sure. Do a show all records first or something.)

                      Since I can't actually see your layout, it's difficult to know what might be taking so long to update. You might try duplicating your layout and modifying your script to run on the duplicate layout, then remove a few items at a time from this new layout until you no longer get the hour glass. When the hour glass no longer appears, take a closer look at the items you just removed from the layout.

                      • 8. Re: Perform Find Script - Hourglass
                        Miguel

                        Hahaha!!

                        I found the problem! When I created this layout I wanted to see if the scrip triggers were my best option, so I set OnLayoutEnter and later on OnModeEnter. I forgot I had these two checked so that's why it kept on loading data and going through a loop Embarassed

                        thanks for pointing out to eliminate one thing at the time, until the hourglass was gone!

                        -Miguel

                        • 9. Re: Perform Find Script - Hourglass
                          philmodjunk

                          Do you have FileMaker advanced?

                          It can be very useful in some of these type issues as you can enable the script debugger and then watch things happen one step at a time. When your script trips a script trigger and that script starts up, you'll see it happen in the debugger...

                          • 10. Re: Perform Find Script - Hourglass
                            Miguel

                            I do have Advanced and it's time to start using the script debugger.

                            Thanks for your suggestions; you're awesome, man!!

                            -Miguel