7 Replies Latest reply on Jan 3, 2012 4:11 PM by philmodjunk

    Export script

    MikeF

      Title

      Export script

      Post

       

      Would like a script to:

      Filter layout Companies for CompanyTypeID = 4.

      Export fields CompanyID, Company, CityID, City to the same Excel file and sheet, overwriting the previous export.  Essentially a simple update.

      Already have:

      Go To Layout = Companies

      Perform Find [Restore] CompanyTypeID = 4

       

      ... But it seems ExportRecords wants to create a new Excel file.

      I merely want to copy the filtered table's four fields to the same sheet, say D:\Filemaker\CompaniesCities.xlsx  --- sheet name CompaniesCities.

      Can this be done?

      Thanks,

        Mike

       

       

        • 1. Re: Export script
          philmodjunk

          If you are completely discarding the current copy of D:\Filemaker\CompaniesCities.xlsx for a new copy with your exported data, then you can put together a script step like this:

          Set Variable: [$Path ; Value: "D:\Filemaker\CompaniesCities.xlsx"]

          Then thpe in $Path (no quotes) as the OutPut file.

          If you want to append the data to data already present in that excel file, then this can be done, but it's much more complex an undertaking.

          • 2. Re: Export script
            MikeF

             It's necessary to actually replace the data on a specific sheet in within the Excel file.

            However -- believe your succinct solution will get me to the point where the rest will just plain have to be done in Excel.

            Thanks Phil.

            • 3. Re: Export script
              philmodjunk

              It is possible to export the data to a different file and then trigger Excel to import the data. I haven't done this, but others here in the forum have been able to fully automate the process.

              • 4. Re: Export script
                MikeF

                 It's not working.

                For some reason the script is excluding the D: from the path.

                ?????

                Thanks,

                  Mike

                • 5. Re: Export script
                  philmodjunk

                  Can you post the script that you are using?

                  To post a script to the forum:

                  1. You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
                  2. You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
                  3. If You have FileMaker advanced, you can generate a database design report and copy the script as text from there.
                  4. If you paste a text form of the script (options 2 and 3), you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)

                   

                  And also post what you have entered in the File Reference dialog in the Export Records step.

                  • 6. Re: Export script
                    MikeF

                     I found the problem.

                     

                    Looking at the export guidelines closely ... You can't use the normal Windows path, copied from the directory window. It needs to see a foreslash as opposed to a backslash, and that foreslash also has to go in front of the drive letter.

                    So "D:\Filemaker\CompaniesCities.xlsx" in export terms has to be "/D:/Filemaker/CompaniesCities.xlsx" .

                    At least, that's what works.

                      Mike

                    • 7. Re: Export script
                      philmodjunk

                      Good catch. You can actually use \, but then you have to use it twice for every instance of the slash as it's the "escape" character when used inside a quoted string of text. (\" placed inside a quoted screen escapes the " to include it as a character inside the quoted string instead of the quotes that end the string of quoted text...)