4 Replies Latest reply on Nov 26, 2014 10:14 AM by lmnieves

    Sharing a file reading data from an external source (another FM file)

    lmnieves

      I am trying to share a file from FileMaker Pro Advance with the Server version. I am having a particular problem with this because this shared file is attached to an external file. Both files are in different locations, but within the same server where FM Server is located. The two files work more or less like this. One file imports data from text files coming from another program. This is the repository. Then, a second FileMaker file is linked to this for reading the data and performing some calculations and serve as the reporting interface. However, the reporting interface file does not copy the data, just read from the external tables. I loaded first the reporting interface into FM Server. When logged in, the system showed a warning message about the "repository" file being a "shared" file and should not be "opened" from a remote location, but from a location where the FM exists.

       

      I tried uploading both files into FM Server, changing their "sharing" parameters, but nothing seemed to work. Could someone point me to the right direction on how to make these two related files work on FM Server? This is the first time I try to do this kind of arrangement. All the other I made, contained the data within the same file, not from an external source.

       

      How should I handle this?

       

      Thanks in advance!!!

       

      lmnieves

        • 1. Re: Sharing a file reading data from an external source (another FM file)
          robwoof

          Hi Luis,

           

          It is not clear from your description what you have actually done, so I will go through a few things that you may already know, just in case.

           

          1) When a file is hosted on FileMaker Server, you open it in FileMaker Pro by going to File->Open Remote…, and pointing FileMaker Pro to the FileMaker Server and choosing the file you want to open.

          2) The "open from a remote location" warning generall occurs when you have the file stored on a file server (not FileMaker Server, file server). FileMaker Pro warns you about this because this is a bad way to have a "shared by FileMaker Pro" database file open. So if you are opening one or more of the files when they're stored on another computer and not through File->Open Remote, you are making problems likely.

          3) If you are, in fact, opening the first file correctly, the problem may be in the file references. In FileMaker Pro, go to File->Manage->External Data Sources… You need to make sure that the reference to the other file is simply "file:<filename>", not in the form "filewin:C:/path/to/file/<filename>" or "filemac:Macintosh HD/path/to/file/<filename>".

           

          Does that help?

           

          Cheers,

          Rob

          • 2. Re: Sharing a file reading data from an external source (another FM file)
            lmnieves

            Thanks for your prompt reply!

             

             

             

            Let me go over into some more detail.

             

             

             

            I am using two different files for this solution. One, let's call it READER, imports data from text files created by a weighing application. The text files are generated on a daily basis, so there is a new text file for each day. The READER looks for the corresponding file to import based upon the current date and imports the data updating existing records and adding any new data as new records. It contains a script for changing filenames and importing the data accordingly. During development, I located this READER in the same folder where the exports or text file reports from the weighing software are. I did this, as in some literature it said that for a timed script to run properly from FM Server for reading or importing text files, the file should be located where the files to be imported reside. This location indeed is in a shared drive, namely "I:" o " I Drive".

             

             

             

            The second FM file, the INTERFACE, was developed and saved in my computer drive, i.e. "C Drive" or "C:". This second file has a link to an external FM source, which is the READER, located or defined to be in the "I:". (It has two table occurrences from the READER, where INTERFACE reads the weighing records). The INTERFACE then perform calculations and summarizes the data. Within the INTERFACE, we also create "manual entries" which are later copied to READER through a script.

             

             

             

            Thus, I open the INTERFACE, it looks at the linked table from the READER and shows summarized data in the screen, and some statistics. In addition, the INTERFACE pulls the data for generating reports. No weighing data is stored in the INTERFACE.

             

             

             

            After completing the solution, I uploaded the files, first the INTERFACE, later the READER into FM Server through the "Upload Database Assistant". And when a new user tried to open the file, the warning message appeared, saying that the READER was located in a 'shared drive' and some epic disaster may happen due to this. After kicking the computer, the walls, doors, whiteboards, throwing all books, papers and stuff around while singing the #$&@$% tune, I checked your recommendation and noticed indeed that the INTERFACE is looking at the READER in the "I: Drive".

             

             

             

            What should I do? If I need to read the text files in the shared "I: Drive", while FileMaker Server is located in another machine / drive.

             

             

             

            Thanks!!!

             

             

             

            lmnieves

            • 3. Re: Sharing a file reading data from an external source (another FM file)
              robwoof

              Thanks, Luis. That makes the situation clearer.

               

              OK, so we have two issues here:

              1) Getting the regular imports happening automatically now that the database files are hosted on FileMaker Server, and

              2) Making sure the database files are interacting with the correct versions of each other.

               

              Deal with 2) first: in BOTH files, make sure that the references to each other are in the form "file:READER" and "file:INTERFACE".

               

              Now to getting the imports happening properly.

               

              You have an existing process where the daily weighing files are placed on a file server. The daily files need to be imported into READER, using scripts you have carefully developed and debugged.

               

              Ideally the daily import processing would be undertaken using a scheduled script on the FileMaker Server, but this has some conditions, mainly that scripts doing file imports run as a scheduled server script can only import from the server's Documents directory in the FileMaker Server data directory. On Windows, that's C:\Program Files\FileMaker\FileMaker Server\Data\Documents, and on Mac it's <hard drive>/Library/FileMaker Server/Data/Documents. So if you can get the daily weighing files from the file server into the FMServer Documents directory, you can just schedule the script to run in FileMaker Server's admin console. A tool like RoboCopy on Windows creates scripts that can be activated by Window's Task Scheduler to (for example) duplicate the contents of the weighing reports directory on the file server into the Documents directory. Others may be able to suggest some similar OS-level scripting if your server is a Mac.

               

              If this is not an option, then you can set up a separate machine (or the server itself, if IT are happy with this) to run a daily OnTimer script to trigger the loading script each day (i.e. every 86400 seconds). This would be happening in ordinary FileMaker Pro. As mentioned, this can run on the server itself, and connect to the databases on the server using File->Open Remote… , ***NOT*** opening the files directly from the FileMaker Server data directory!

               

              In both cases you need to do some adjusting of the import script to deal with the changed path to the daily files directory. If you were running it as a server schedule, the script might look like:

              Set Variable [ $todaysFile ; <existing date-based filename calculation>]

              Set Variable [ $importPath; Get ( DocumentsPath) ]

              Set Variable [ $fullPath; "filewin:" & $importPath & $todaysFile ]  (or Set Variable [ $fullPath; "filemac:" & $importPath & $todaysFile ]

              Import Records [ $fullPath; <whatever other options you have set> ]

               

              If you were running it in FIleMaker Pro, connected by File->Open Remote…, it would look more like this:

              Set Variable [ $todaysFile ; <existing date-based filename calculation>]

              Set Variable [ $importPath; "I:/path/to/reports/directory/" ]

              Set Variable [ $fullPath; "filewin:" & $importPath & $todaysFile ]

              Import Records [ $fullPath; <whatever other options you have set> ]

               

              See how you go with that.

               

              HTH

              Rob

              • 4. Re: Sharing a file reading data from an external source (another FM file)
                lmnieves

                Hello robwoof!

                 

                Thanks for your prompt support to this matter.

                 

                I did copied both files into FM Server, as you recommended. However, I have not tried to do the script changes. I created a button in the Interface file to update the data. So far, so good. The script is clean now and works OK. It did have some modifications required, as it was developed in the old configuration and when copied into the server, it behave poorly. (There were several instructions aimed to check the script while I was developing it...).

                 

                I addressed each file so they look for each other in the server, as recommended. The relationships are working OK. Where it is still differing from your recommendations is where it looks for the text files to be uploaded or imported from.

                 

                The initial version looked for the text files in a different location, where the weighing software saves the reports to. I kept that address in the new version copied into FileMaker Server. When the script was tested again, it looked for the files and imported OK. It was a little bit slower, but I believe it's related to the server configurations, as it is typical for other applications to do the same. Thus, I have the communication going as this. First, you press a button to call a script. This initiates some variables and updates some administrative information and makes a call to another script in the Reader file. This second script does some data manipulation to call the proper text file(s) based upon current date, importing the data from each one.

                 

                There are some additional features that I would like to add to the importing script. After this, I was planning to program a script in FM Server to call the first script (in the Interface). I believe this may work.

                 

                I still do not understand why in some literature it asked to have a second file located where the text files would be. Maybe I read it wrong. I will consult again to see what happened...

                 

                Thanks for all your support and sharing your knowledge with me. I appreciate it a LOT!

                 

                Have a nice day and happy HOLIDAYS!!!

                 

                lmnieves