AnsweredAssumed Answered

Slow Sort

Question asked by FileMakerNovice on Feb 7, 2013
Latest reply on Feb 7, 2013 by davidanders


Slow Sort



     I have an issue with "Records Remaining to Sort" taking 5-10 minutes on around 200 records.  Let me give you a brief description of my database:



     Employee-Stats (Same for Calls)

     In employee, I have around 15 calculation fields that get information from Calls and Stats.  There is also a calculation field that adds and uses these 15 fields.  This is called "FinalGrade".  

     There are around 100 employees.  There is a field called "Rank" that is boolean.  Calls and Stats have around 20,000 records a piece.

     When I go to a layout called "Ranking", it performs a find from start to end date and omits all non-ranked employees.  It then sorts them by "FinalGrade".  After this, it records the employee's rank into a field.  There is another calculation it does to determine if the employee is in the top 25% of employees.  When I run the script, it gives the Sorting message, then two update messages and then another sorting message.  The first sorting progress bar takes over 5 minutes the first time.

     Here is the script:
     Go to layout["ranking"(ranking)]
     Enter Find Mode [restore]  //Specifies ranked=1
     Sort Records[Restore; No dialog]  //Specifies to sort by final grade.
     Replace Field Contents [no dialog; employee::rank; get(recordNumber)]
     Replace Field Contents [no dialog; employee::rank; if(get(recordnumber)<=Get(foundcount)*.25; "Top 25%"; People::Bucket)]