4 Replies Latest reply on Aug 18, 2015 2:21 PM by miw

    Scripting to export select data to an Excel file

    miw

      Title

      Scripting to export select data to an Excel file

      Post

      As much as I have searched the forum, I cannot find the simple solution to write a script that will export only select data from a FM table from beginning to end.  Nothing complex; just straight data for select predefined field as defined in the script.  I want to be able for the end user to simply push a button which will go through the motions for the download. Can someone provide or reference me to a solution?

        • 1. Re: Scripting to export select data to an Excel file
          SteveMartino

          Is it always the exact same fields?

          If I understand you correctly, create a layout with just the fields you want to export.  When the user clicks the button to perform the script, have it:

          Freeze window

          Change layout to the layout with the fields you want to export

          Perform the export

          Go back to the original layout

          But the better way is in the export dialog, to just select the fields you want to export, and how you want them grouped

           

          • 2. Re: Scripting to export select data to an Excel file
            philmodjunk

            Export Records exports all the records in your current found set. So to export data from a select record or group of records requires producing a found set of just the records that you want to export. The Export Script step then has a dialog box for specifying what fields to include from that found set in your export. So if it is the same fields every time it's a fairly straight forward thing to set up.

            • 3. Re: Scripting to export select data to an Excel file
              miw

              PhilMod:  My window already shows the found set to export; I just do not know the script to export only specific and select data fields from the active table.  I created a script line:

              Export Records [No Dialog]; "StoneDownload.xlsx"; Automatically open; Unicode (UTF-16)]

              This worked initially quite well but now I cannot figure out how to add or delete previously defined data fields for export - it always exports my first version of data. (and to be honest, I can't figure out how I originally set up that spreadsheet months ago!)

              • 4. Re: Scripting to export select data to an Excel file
                miw

                I just figured it out after trial and error.  Now I see in the Export Records script line to "Specify export order" button to make the changes (it had scrolled off the bottom of my screen).