10 Replies Latest reply on Feb 10, 2016 11:14 PM by Powerbook

    Temporary Path

    Powerbook

      I'm having some troubles with exporting and importing data in tables.

      When I use the function Get(TemporariPath) on a Solution that running is running  on FMserver everything works fine.

      When I use the same function on Mac or Windows Local version, I get an error like "Filemaker was not able to create file, or the file is damaged..."

      What happens is that the file is created, but empty.

       

      My question is:

      Can I use "TemporaryPath" in a script that is working on all FM versions, from a Runtime to a Local and up to a Server version?

       

      Thank you in advance

       

       

      ps:

      I need this just to append records from one table to another in the same solution.

      I accept also alternative solutions.

        • 1. Re: Temporary Path
          bdj

          I have exactly the same problem.

          I guess it has something to do with file permissions, but it is not clear to me what exactly is causing this problem.

          Bernard.

          • 2. Re: Temporary Path
            DanielShanahan

            Powerbook wrote:

             

            When I use the function Get(TemporariPath) on a Solution that running is running  on FMserver everything works fine.

             

            Does this mean:

            1. You ran the script from a client (e.g. FileMaker Pro on Windows) on a hosted file using Perform Script on Server?

            2. You created a server side script in FileMaker Server?

            3. You have a FileMaker Pro on the server machine that also has FileMaker Server and you ran the script from the client?

             

            Also, can you post your export script?

             

            One thing that I usually do when creating routines that export/import using the Temporary Path is first use the Desktop Path so I can quickly see the file generate and see if it contains the expected data set.  Once I verify everything is as expected, I change to the Temporary Path.

            • 3. Re: Temporary Path
              Powerbook

              Hallo Daniel

               

              The working solution is to have Filemaker Server and accessing via Filemaker Pro or even WEB of IOS.

              I do not use the instruction "Run script on server".

               

              If I create a local version on Filemaker Pro I have the issue with the temporary file path.

               

              ps:

              How can I copy and paste my Script in the forum?

              From the FM Pro software script editor is impossible to copy and paste outside FM

              • 4. Re: Temporary Path
                skywillmott

                One way to achieve what you are trying to do, i.e. 'append records from one table to another' would be to use the 'Import Records...' script step, which allows you to import records from one table to another within the same file.

                 

                Not too sure what is happening with your TemporaryPath problem - seeing the script would be useful...

                 

                One easy way to copy and paste the script steps if you are using Mac is to choose to print the script, and instead of printing choose to 'Open PDF in Preview' from the 'PDF...' popup menu. Once opened in Preview you can just select and copy the text....

                • 5. Re: Temporary Path
                  Powerbook

                  Cool thanks:

                   

                   

                  Set Variable [ $FilePath; Value:Get ( TemporaryPath ) & "Temp.fmp" ] Go to Layout [ “Banca” (Movimenti) ]
                  // Show All Records

                  Perform Find [ Specified Find Requests: Find Records; Criteria: Movimenti::Causale 3: “"p"” ]

                  [ Restore ]

                  Export Records [ File Name: “$FilePath”; Character Set: “Unicode (UTF-16)”; Field Order: Movimenti::ID movimento

                  Movimenti::ID Socio Movimenti::Data Movimento Movimenti::Anno Sportivo Movimenti::Causale 3 Movimenti::Mese Retta Movimenti::Descrizione Movimenti::Quota Sociale Movimenti::Cadenza Movimenti::Tipo Movimento Movimenti::Tipologia Pagamento Movimenti::Pagato Movimenti::Entrate Movimenti::Uscite Movimenti::Saldo Movimenti::Somma Entrate Movimenti::Somma Uscite Movimenti::Storno Movimenti::Protocollo Movimenti::ricevuta Movimenti::Causale Movimenti::Causale 1 Movimenti::Causale 2 Movimenti::Log Movimenti::DataStorno ]

                  [ No dialog ]

                  Go to Layout [ “Patrimoniali” (Patrimoniali) ]

                  # *** tutti i patrimoniali P vengono rimossi e poi nuovamente inseriti per evitare doppioni

                  Perform Find [ Specified Find Requests: Find Records; Criteria: Patrimoniali::Causale 3: “"P"” ]

                  [ Restore ]

                  Delete All Records

                  [ No dialog ]

                  # ***************************************************************
                  # **** Importazione patrimoniali dell'esercizio in corso **********

                  Import Records [ Source: “$FilePath”; Target: “Patrimoniali”; Method: Add; Character Set: “Mac Roman”; Field Mapping:

                  • 6. Re: Temporary Path
                    skywillmott

                    As previously suggested, you might want to change TemporaryPath to DesktopPath so you can check that the file gets created correctly... Also a good idea to use the correct file extension of .fmp12 instead of just .fmp

                    • 7. Re: Temporary Path
                      Powerbook

                      Wow it works!!

                      I will make some tests, but now with FM Pro it works and creates a temp file on the desktop.

                      I just now have to try it with Windows systems too.

                       

                      Thank you

                       

                      ps:

                      How do I delete from the script the temporary file that is created on the desktop ?

                      • 8. Re: Temporary Path
                        robwoof

                        If you want to have a file on the Desktop (or somewhere else) only while it's being used, and then delete it, use the "zero found set" trick.

                         

                        Something like this will get the job done:

                         

                        <prepare found set for export>

                        Export Records [ Desktop/filename.fmp12 ]

                        <do other stuff you want the export for>

                        Show All Records

                        Show Omitted Only

                        # this sets the Found Set to 0 records

                        Export Records [ Desktop/filename.fmp12 ]

                         

                        If you script an export to a filename/path, it replaces any existing file of that name at that path with the export. When the Found Set has zero records, it deletes the file if it exists and replaces it with nothing.

                         

                        Use with care, but a useful trick!

                         

                        HTH

                        Rob

                        • 9. Re: Temporary Path
                          RickWhitelaw

                          a file saved to the desktop is not a temporary file. Once you have everything working go back to using Get(TemporaryPath). Any file created there will be cleared upon exiting FM.

                               My 2 cents.

                          • 10. Re: Temporary Path
                            Powerbook

                            Tank you Rob and Rick for the hints.