6 Replies Latest reply on May 19, 2017 4:00 PM by beverly

    server path

    pfroelicher

      Hi

      I try to run a script on server to generate a pdf file and store it in a container field, so users can se the report with a simple click instead of having to generate it each time.

      I have heard, that in fms16 you can do that now in Server.. but the "insert pdf" command is still dimmed. So I tried Insert from URL, which work on server.

      My script finds records, sorts them, sets $caminho to Get(TemporaryPath)$nameofmyfileDDMMYYHHMM, saves the .pdf and inserts from URL into a container field.

       

      Thereby I observed that on a client machine the path (obtained with GET(TemporaryPath) to get the URL one has to substitute the name of the HD with file:///private/.

      from this

      /hd250gb/var/folders/ph/9ydk6vyn2237x0gbr792bzgc000101/T/S10/relmat12-05-2017h1642.pdf

      get this.

      file:///private/var/folders/ph/9ydk6vyn2237x0gbr792bzgc000101/T/S10/relmat12-05-2017h1151.pdf

      Which was easy with the replace function.

      On a client my script works fine.

      But on the server the path becomes:

      /server100gb/var/folders/cc/vj9msh_15mg7lxdql_wnfn600000gp/T/S10537/relmat15-05-2017h1736.pdf

      And testing this in the browser on the Server machine I cannot access the file.

      Where do I have to create the pdf to, so that I can read it into a container field and serve it to clients. Or how can I modify the script so it runs on server (or better still on clients and server).

      txs

      Pierre

        • 1. Re: server path
          user19752

          I found 10 years old function, FileMaker Custom Function:FilePathToURL ( FMFilePath )

          Does adding "Volumes" not work on recent FMS?

          • 2. Re: server path
            beverly

            OSX? does it have any relation to this thread:

            "Web Viewer, OSX10.12.4  The local path pattern is no longer valid. Why?"

            • 3. Re: server path
              pfroelicher

              Hi User..

              thanks for you reply. Sorry I only saw it now.. some spam filter.

               

              I managed to do it all in filemaker native.

              The secret is to use get(documents path ), it seems that server does not access the Temporary folder as well as the Library/Filemaker Server/Documents folder.

               

              I am a bit proud..hehe..

              My script does, check if it IS on server, calculate a path, $caminhoserver save a pdf to this path and then uses Insert from URL to import from this pdf at $caminhoserver which is on the following place:

               

              /server100gb/Library/FileMaker Server/Data/Documents/relmat19-05-2017h1545.pdf  change it to URL notation

              file:///Library/FileMaker Server/Data/Documents/relmat19-05-2017h1545.pdf

               

              To clean up it uses Export Records with an empty set to delete this file.

              • 4. Re: server path
                pfroelicher

                Beverly,

                no.. it is no bug.. I think. I think that Filemaker server can only write to Get( TemporaryPath).. but not read afterwards, since, as I understood it, this folder is deleted after the script. .... Or at least I could not make it work.

                 

                However I managed to create a pdf on server, save it to Get(DocumentsPath), then import that .pdf with the Insert from URL script step into a Container field, so that Users can always access this file/report with click. Then I delete the pdf file in the Library/Filemaker Server/Documents folder by Export Records with an empty set.

                • 5. Re: server path
                  pfroelicher

                   

                  Here a pdf of the script.

                  • 6. Re: server path
                    beverly

                    Yes, the Documents (relative to FMServer, not a User!) and Temporary directories are available to FMS. The Temp does delete automatically.

                     

                    If you need to delete from the Documents folder, there are thread here (and elsewhere) to show you ways.

                    Beverly