If I attempt

DatabaseExportCSV ""

I get prompted to name the new file and a .csv file gets created. But if I attempt

  DatabaseExportCSV "~/Junk.txt"

I get

FileSave error: The file "Junk.txt' doesn't exist.'

regardless if there is no file, or an empty file with that name at that location.

In the DATABASEEXPORTCSV procedure lines 37-39 are adding extra text to the path. Your path of “~/Junk.txt” is converted to “/Users/username/Documents/~/Junk.txt”. if you change line 37 to read:

if exportPath notmatch "*/*" 

instead of:

if exportPath notmatch "/*" 

you will have it function properly in your case.

I’ll leave it to Jim to further address this as to the permanent fix. The same code is also found in the DATABASEEXPORTJSON and DATABASEEXPORTTSV procedures.

That’s going to break relative paths to a subfolder, because it excludes any path with a slash in it. I think that should be

if exportPath notmatch "/*" and exportPath notmatch "~/*"
1 Like

Thank you David, that is indeed the fix and I have gone ahead and corrected all three of these statements (thanks also to Gary for pointing out that the fix was needed in 3 places).

In the meantime, Robert can get his code working with this adjustment, no need to tweak the library code:

databaseexportcsv info("userfolder")+"/Junk.txt"

4 posts were merged into an existing topic: Can’t get filerename statement to work