AnsweredAssumed Answered

FMP - Script - import FM earlier to FM current - multiple Tables

Question asked by SeanO on Oct 23, 2012
Latest reply on Oct 25, 2012 by philmodjunk

Title

FMP - Script - import FM earlier to FM current - multiple Tables

Post

     I am setting up a script to import data from one FM file into multiple tables within the current FM file from an earlier backup. The imported file is in Filemaker native format.

     The area I need assistance with is to assign a variable to a user selected file. The backups are named "Monday" "Tuesday" "Wednesday" etc. The scipt will not know the name of the source data file it is importing. The user needs to select this file via dialog.

     The restore process is currently working as intended - however it is requesting the name of the source file with every table it is updating. Needless to say this is unecessary and could lead to user error in repeatedly selecting the source file.

     Below is a portion of the script to give a better indication of how the script is performing.

     Two specific things I am looking for - in order of importance.

     1: How to set a variable to allow the user to select the source file once, up-front to automate the rest of the import script.
     2: Is there a better way of doing this than I currently am.

     Many thanks in advance for your input and expertise.

     Sample of some of the data below:

     #--------------------------------------Makes sure the user wants to do this process...
     Show Custom Dialog [ Title: "Purge and Restore ALL Records"; Message: "You are about to Purge and Restore ALL Records.¶¶Press OK to Continue or Cancel to EXIT this ruting"; Default
     Button: “OK”, Commit: “Yes” ; Button 2: “Cancel” , Commit: “Yes” ]
     If [ Get (LastMessageChoice) = 2 ]
     Exit Script [ ]
     End If
     #
     #--------------------------------------Begin the Process ...
     Go to Layout [ “MstrLister” (MstrLister) ]
     Show All Records
     Delete All Records
     [ No dialog ]
     Import Records [ Target: “MstrLister” ; Method: Update existing ; Add remaining; Character Set: “Windows ANSI” ; Field Mapping: Source field 1 import to MstrLister::Lister ]
     [ No dialog ]
     Show All Records
     Go to Layout [ “MstrCompType” (MstrCompType) ]
     Show All Records
     Delete All Records
     [ No dialog ]
     Import Records [ Target: “MstrCompType” ; Method: Update existing ; Add remaining; Character Set: “Windows ANSI” ; Field Mapping: Source field 1 import to MstrCompType::MstrCompType ]
     [ No dialog ]
     Show All Records
     Go to Layout [ “MstrSuburb” (MstrSuburb) ]
     Show All Records
     Delete All Records
     [ No dialog ]

Outcomes