1 Reply Latest reply on Jan 31, 2013 3:40 PM by philmodjunk

    Struggling with Server Side Scripts - Export

    JimZafrani

      Title

      Struggling with Server Side Scripts - Export

      Your post

           Hello All, 

           I need to setup a server side scheduled script that exports one of the layouts to a file every day at a specific time. The script that I setup is:

            Go to Layout [ “SKUs 1 Basic” (SKUs) ]

      Perform Find [ Specified Find Requests: Find Records; Criteria: SKUs::Attrib_3: “=:” AND SKUs::Qty_Avail: “25” ]

           [ Restore ]

      Set Variable [ $filepath; Value:"filewin:" & Get ( TemporaryPath ) & "HDI-ATS-EXPORT.csv" ]

      Export Records [ File Name: “$filepath”; Character Set: “Windows (ANSI)”; Field Order: SKUs::Product_ID

           SKUs::SKU

           SKUs::Attrib_2

           SKUs::Attrib_2_Name

           SKUs::Attrib_4

           SKUs::Qty_Avail

           SKUs::Retail

           SKUs::Price

           SKUs::Description

           Products::Class ]

           [ No dialog ]

            

           The script runs fine on the client but on the server, when scheduled, all I get are: 

            

            

           2013-01-31 12:10:00 Server Events Information Schedule "ExportSKUAvailability" has started FileMaker script "ExportInventory".
            
           2013-01-31 12:10:02 Server Events Information Schedule "ExportSKUAvailability" scripting error (4) at "ApparelMagic 10 : Startup : Allow Toolbars".
            
           2013-01-31 12:10:02 Server Events Information Schedule "ExportSKUAvailability" scripting error (4) at "ApparelMagic 10 : Startup : Move/Resize Window".
            
           2013-01-31 12:10:03 Server Events Information Schedule "ExportSKUAvailability" scripting error (4) at "ApparelMagic 10 : Window Control Browse : Adjust Window".
            
           2013-01-31 12:10:03 Server Events Information Schedule "ExportSKUAvailability" scripting error (401) at "ApparelMagic 10 : Authorizations Cleanup : Perform Find".
            
           2013-01-31 12:11:07 Server Events Information Schedule "ExportSKUAvailability" scripting error (4) at "ApparelMagic 10 : Window Control Browse : Adjust Window".
            
           2013-01-31 12:11:08 Server Events Information Schedule "ExportSKUAvailability" completed.

           Any ideas or help would be greatly appreciated! 

           Thanks, 

           Jim

            

        • 1. Re: Struggling with Server Side Scripts - Export
          philmodjunk

               Even though this script step is shown as server compatible, there are extreme limitations on where and how you can export data using a server scheduled script.

               See this knowledge base article for the details: http://help.filemaker.com/app/answers/detail/a_id/7035/kw/server%20import%20records

               An alternative that we use to get around these limitations is to use a robot file opened via an OS Based Scheduler--Windows Task Manager in our case. The robot file is set to perform a script on the hosted file to export the data (actually we import the data from one Filemaker file into another) automatically when it is opened and then it use quit application to close down both the file and the FileMaker application. This works because the robot file functions from a client context instead of the server schedule context.