3 Replies Latest reply on May 4, 2016 7:00 PM by user19752

    Exporting from Web Direct

    facaylar

      Hi y'all - got another thing I need a pointer with. I have a solution that exports data to a user's desktop. If they're using the desktop application, it's fine and works flawlessly.

       

      However, because of the need of portability on this solution, it's also available on WebD. Like I mentioned, one of the actions available is exporting records to the desktop. In WebD, this "automated" part fails and provides this error.

       

      I know it's due to the Windows permission not allowing the script to automatically save to the desktop. Can someone point me in the right direction to resolve? In the export script, I have:

       

      > Set Variable [$Export_File; Value: "file:" & Get ( DesktopPath ) & "File_Name.xlsx"]

      > Export Records ["$Export_File; Unicode (UTF-16)]

       

      I'm missing something really elementary and I know that there's a step I need to put in when a user is in WebD that asks them WHERE to save the file, instead of it automatically saving it...which is what causes the error. I just can't find documentation on that step. Any help would be helpful. Thanks!

        • 1. Re: Exporting from Web Direct
          user19752

          It is not allowed for security reason, so you can't do it.

          Only the user can select where to save.

          • 2. Re: Exporting from Web Direct
            facaylar

            Yeah, I ended up confirming that shortly after posting.

             

            This portion of the script is actually part of a bigger script - there are two previous steps prior that whittle down the records until the appropriate set is found with appropriate "Exit Script []" points (when searches fail, etc.) along the way.

             

            I actually managed to resolve this earlier this morning, but have, inexplicably lost the ability to do so.

             

            One of the things I ended up having to do was adding an intermediary if/end-if which checks the system platform so it knows if it's to export a CSV or an XLSX:

             

            If [Get ( SystemPlatform ) = 4]

                 Set Variable [$Export_Name; Value:"file:" & Get ( DesktopPath ) & "FileName.csv"]

                 #The above CSV is actually a 'Merge' file type. This is done because the generated csv will be fed into a mailing software and we match via field names and the 'Merge' file type provides the field names on the first row.

                 #It should also be noted here that ability to access using WebD is important as the users will sometimes be accessing from various workstations and those workstations do not have FMP installed.

                 Export Records [No dialog; "$Export_Name"; Macintosh]

                 Close Window [Current Window]

                 Set Error Capture [Off]

            Else

                 Set Variable [$Export_Name; Value:"file:" & Get ( DesktopPath ) & "FileName.xlsx"]

                 Export Records [No dialog; "$Export_Name"; Unicode (UTF-16)]

                 Replace Field Contents [No dialog; XX:YY; "Value"]

                 Close Window [Current Window]

                 Set Error Capture [Off]

                 Exit Script []

             

            On the desktop app (both Mac and Windows), this works flawlessly, spitting out the XLSX  at the path specified.

             

            In WebD, I am aware of the limitations:

             

            • Excel formats not supported (hence the first step in the 'check', so to speak, which determines if the user is running this script from a WebD interface, SystemPlatform = 4) which could then spit out a CSV.
            • If the Specify output file option is selected, FileMaker WebDirect outputs exported records with the specified filename and file type but ignores the specified file path.
            • FileMaker WebDirect outputs exported records to the web browser’s default download location.

             

            However, I just can't figure out why it worked this morning and then no longer exports today. It looks right...maybe I'm missing something exceptionally simple?

            • 3. Re: Exporting from Web Direct
              user19752

              What do you see as "no longer exports" ?

               

              something to do

              1) remove unsupported setting that "no dialog" and "path" from export step

              2) search other files that saved with numbered like filename(1).csv etc.

              3) confirm there are records to export in found set