2 Replies Latest reply on Nov 24, 2015 2:22 PM by keywords

    Slight behaviour change in Export Script Step FMP 11, 12, 13 and 14 OS X

    StephenWonfor

      Hi

       

      OS X, by default, hides file extensions.  I have always tried to remember to append the correct extension when doing Variable driven exports.  A client has reported that some routines he has used for years have stopped working - exports to Excel.  Recently upgraded him from FMP 13 to FMP14.  It would seems that, by sloppy coding on my part, that failing to append the "xlsx" file extension will create an unusable file when run in FMP 14.  After testing I note that FMP 12 and 13 will create a useable Excel file without my adding the file extension.  FMP 14 creates an odd, empty text edit file.  Even odder with an export to Filemaker fmp12 format.  FMP 12, 13 and 14 will create, without the explicit extension, a file that opens in Font Book.  With the extension I get a normal FMP12 database.  Btw - I am running 10.9.5, he is running 10.10.x.

      Testing then got out of hand.  Pasted the code into an FMP11 database (changed fmp12 to fp7) and it all works with or without the extension being specified.

       

      The lesson is, I suppose, "Code What You Mean And Not What You Assume."

       

      Set Variable [ $Version; Value:Int(Get ( ApplicationVersion )) ]

      #Desktop has 4 folders - 11, 12, 13, 14

      #Excel is set in the Export filetype

      Set Variable [ $Output; Value:Get ( DesktopPath ) & $Version & "/SomeFile_01" ]

      Export Records [ File Name: “$Output”; Automatically open; Character Set: “Unicode (UTF-16)”; [ No dialog ]

       

      Set Variable [ $Output; Value:Get ( DesktopPath ) & $Version & "/SomeFile_02" & ".xlsx" ]

      Export Records [ File Name: “$Output”; Automatically open; Character Set: “Unicode (UTF-16)”; [ No dialog ]

       

      #Filemaker is set in the Export filetype

      Set Variable [ $Output; Value:Get ( DesktopPath ) & $Version & "/SomeFile_03" ]

      Export Records [ File Name: “$Output”; Automatically open; Character Set: “Unicode (UTF-16)”;[ No dialog ]

       

      Set Variable [ $Output; Value:Get ( DesktopPath ) & $Version & "/SomeFile_04" & ".fmp12" ]

      Export Records [ File Name: “$Output”; Automatically open; Character Set: “Unicode (UTF-16)”; [ No dialog ]

       

      Stephen

       

       

      "There are two ways to write error-free programs; only the third one works."~Alan J. Perlis

        • 1. Re: Slight behaviour change in Export Script Step FMP 11, 12, 13 and 14 OS X
          keywords

          A couple of comments:

          1.     If a file has no file extension the OS will sometimes take a guess at the file type, which might explain the Font Book experience.

          2.     If you have created files that should be xl files, you could try manually adding the file extensions in Finder. Finder will post  dialog saying this is unwise (which it is, but it can be done), but just ignore this and do it anyway (I'd suggest using .xls rather than .xlsx as it's more generic). If the file subsequently opens with Excel then all is well. If it doesn't, then remove the extension you just added—you'll get the same warning again, which you again ignore.

          3.     A big tick to your learned lesson about coding export files—don't forget the file extension!

          4.     Hiding file extensions is a Finder preference (see screenshot), and I suggest you always show them.

               Screen Shot 2015-11-25 at 9.17.21 am.png

          • 2. Re: Slight behaviour change in Export Script Step FMP 11, 12, 13 and 14 OS X
            StephenWonfor

            Keywords

             

            1.  Interesting bit is how Filemaker is creating slightly different files when exported from various version on the same OS.

            2.  Could do - but not client friendly.

            3.  Knowledge is power.

            4.  Knew that but don't care for the look.

             

            Stephen