5 Replies Latest reply on Aug 8, 2015 3:53 PM by philmodjunk

    Can I default to export file format to .csv on a given path?

    baleihi

      Title

      Can I default to export file format to .csv on a given path?

      Post

      I'm exporting a .CSV file and I want the user to specify the name of it.  If I uncheck the "Specify output file" box, FM opens the previous directory and defaults to show .tab files.  I want to name the directory and show only .csv files.  TIA,

      Bob

        • 1. Re: Can I default to export file format to .csv on a given path?
          philmodjunk

          If you use your own dialog or field on a layout for the user to enter or select a file name, you can set a variable to the filepath--including the file name from this field and then, in the export File's "specify output file" dialog, you can type in the exact name of this variable.

          • 2. Re: Can I default to export file format to .csv on a given path?
            baleihi

            That's not exactly the problem.  I don't want the user to have to type in a full filename.  I want them to see a list of the existing csv files in a known directory and then either choose one of them to overwrite or type in a new name.  The problem is that I don't know how to specify a path (FM goes to the previously used directory) or get it to show only the csv's that are there.  Conceptually, I want to put something like C:/User/OutputDir/*.csv as the export filename and have it prompt me for a filename, showing the csv files in that directory.  When I put a wildcard in the filename I get an ugly error.  I vaguely recall an alternative way to specify a filename via a system dialog box, move the user's input into a variable, then export to that.

            • 3. Re: Can I default to export file format to .csv on a given path?
              philmodjunk

              You can use Insert File to open a dialog where the user selects the file. Insert file can be set to only list csv files and to limit the insertion to only store a reference to the selected file in the specified container field. Your script can then extract the file path from this container field to a variable and use it for the export.

              FileMaker's inability to automatically "go to" a specific folder for this type of dialog has long been an irritating limitation. FileMaker 14's new Get Directory partially resolves this issue as you can use it to display the contents of a specific directory. You might experiment with it and see if it helps.

              Beyond that you are either looking at plug ins or possibly working with Get ( DirectoryPathListing ) if you put the csv files in a directory inside the Documents folder.

              • 4. Re: Can I default to export file format to .csv on a given path?
                baleihi

                Thank you PMJ.  That works as long as I overwrite an existing file.  But I would also like the user to be able to specify a new file, which causes an error if I use Insert.  Doesn't FM have a straightforward way to prompt a user for a filename, with options to set the default path and filter the displayed files to match a pattern?  Seems really fundamental.

                • 5. Re: Can I default to export file format to .csv on a given path?
                  philmodjunk

                  You can if the process was 100% manual and not scripted. When you set up your script with such a set up, the user also get's the dialog to select the fields for export. If you don't want the user to have to deal with those details, you end up have to craft an alternative approach such as using a plug in or Get ( DocumentsPathlisting) to list the contents of a folder in a modal dialog window or popover with a text field for specifying the file name.