11 Replies Latest reply on Aug 1, 2015 7:13 AM by beverly

    Best ideas for creating 1000s of records

    jurgmay

      Hi all,

       

      I am using Todd Geist's HyperList to get a list of IDs from a found set of Customer records. I then need to take these IDs and create records in another table (Prospects).


      Are there any best practices or tricks to create say 2,000+ records. At the moment I'm looping through the list and creating a new record in the Prospects table and setting a ProspectListID field and a ProspectID field (from the HyperList). This takes just over four minutes.


      Here's the script:


      (Note: $prospectListID is received as a parameter and declared using #Assign from www.filemakerstandards.org

      It's value looks like "95E686D-D276-3142-A54C-87E52E4EDDC0")

       

      Perform Script [ "Get Values in Found Set ( FieldName )" ; Parameter ( GetFieldName ( Customers » List::id ) ) ]
      
      Set Variable [ $recordIDs ; Value: Get ( ScriptResult ) ]
      
      Go to Layout [ "@Prospects" (Prospects) ]
      
      Set Variable [ $counter ; Value: 0 ]
      Set Variable [ $listCount ; Value: ValueCount ( $recordIDs ) ]
      
      Loop
      
        Exit Loop If [ Let ( [ $counter = counter + 1 ] ; $counter > $listCount ) ]
      
        New Record/Request
      
        Set Field [ Prospects::id_prospectList ; $prospectListID ]
        Set Field [ Prospects::id_customer ; GetValue ( $recordsIDs ; $counter ) ]
      
      End Loop
      
      
      

       

      I don't see any obvious reason why this takes so long and I don't see a different in performance if this script is called using PSOS.

       

      Any guidance appreciated.

       

      Thanks!

       

      Juerg