5 Replies Latest reply on Apr 18, 2012 1:37 PM by fmvet

    Problem with PC/Mac links to files in containers

    fmvet

      We've encountered a problem opening files (PDFs primarily) placed in container fields. The files are stored in a folder on a server along with FM11 (PC version) and the FM database, and are placed in a container field as references (links) to the actual files.

       

      We have both PCs and Macs as clients.

       

      When a file is placed as a reference in the container by a PC, a PC can open the file, but a Mac can't find the file; similarly, when the file is placed by a Mac, PC users can't find/open the file.

       

      We need to be able to have both PCs and Macs place files in containers and open all files that are placed in the container.

       

      Is this normal behavior? Is there a workaround?

       

      Thanks.

        • 1. Re: Problem with PC/Mac links to files in containers
          Stephen Huston

          We use the Open URL script step to open files, and our URL has to be calculated based on the captured filepath. Mac and Windows read filepaths  differently.

          • 2. Re: Problem with PC/Mac links to files in containers
            fmvet

            Thanks very much for the answer, but it is discouraging to have to use such a difficult workaround.

             

            How do you determine the captured filepath?

            • 3. Re: Problem with PC/Mac links to files in containers
              Stephen Huston

              Oops. Probably nothing is captured because you are storing by reference,

              in which case, you have a fixed filepath.

               

              It just needs to be calculated as a URL.

               

              Our URL is based on this (dynamic) path calc:

              • "http://[IPaddress_here]/" & directory path(s) & "/"

              Yours will need to have the appropriate path parts inserted.

              • 4. Re: Problem with PC/Mac links to files in containers
                TomHays

                fmvet wrote:


                Is this normal behavior? Is there a workaround?

                 

                Unfortunately this is normal behavior for the situation you describe.

                 

                As to a workaround, perhaps.

                 

                If the files that are added are always referenced files in a folder on the server as you describe, you may be able to create a more general file reference immediately after the user adds a file. If this is a scripted activity, add a line to the script. Otherwise use a script trigger.

                 

                Basically what you'll do is to append the Windows file reference to those containers edited my Mac clients and a Mac-specific file reference to those added by Windows clients.

                 

                You'll need to do a bit of homework to find out what you need to add.

                Do a GetAsText(TheContainerField) on a container submitted by a Mac client and another by a Windows client to find out what the file reference looks like in each case. (filewin: for Windows and filemac: for Mac.)

                 

                Then SetField[] on the container to be a calculation that has both formats. You want to add either a filewin: or a filemac: line depending on which is missing.

                 

                This would be something like: (have not tested this)

                 

                Let(

                [

                currentContainerRef = GetAsText(MyContainer);

                theFilename = some calc to extract the filename from currentContainerRef;

                macRef = "filemac:/your mac path here/" & theFilename;

                winRef = "filewin:/your windows path here/" & theFilename

                ];

                 

                Case(

                PatternCount(currentContainerRef; "filewin:") > 0; currentContainerRef & "¶" & macRef;

                PatternCount(currentContainerRef; "macwin:") > 0; currentContainerRef & "¶" &  winRef;

                currentContainerRef

                )

                )

                 

                -Tom

                • 5. Re: Problem with PC/Mac links to files in containers
                  fmvet

                  Tom,

                   

                  Thanks. I think we may go with a relatively simple, if quite clunky, solution, which is to have two container fields, one for a PC and one for a Mac, and then double-place the file(s) using the respecitve platforms. It's unfortunate that what seems like a simple function should be so complicaed in FileMaker. Of course, placing the file itself in the container, rather than a link, would also be a solution, but may make the DB huge.