9 Replies Latest reply on Feb 15, 2011 9:53 AM by raybaudi

    store only as a reference file

    RobertRichards

      Title

      store only as a reference file

      Post

      I have stored a bunch of data (pictures mostly) as reference files into multiple containers. All of the reference files are located in one folder on my hard drive. I now want to move my database and reference files to an external hard drive, so that I can access them from multiple computers. Is there a way to change the path so that Filemaker knows where to look for these files? Thanks.

        • 1. Re: store only as a reference file
          philmodjunk

          Take a look at Replace Field Contents.

          Using the calculation option for this tool, you can update the filepath stored in your container fields for every record in your found set all in one go. (Make a backup copy of your file before you do this, so you can try again, if you don't get the results you expect on the first try.)

          • 2. Re: store only as a reference file
            raybaudi

            "you can update the filepath stored in your container fields"

            How did you do that ?

            • 3. Re: store only as a reference file
              philmodjunk

              Treat the container field as though it is a text field and use Replace Field Contents to modify it accordingly. The exact expression used will vary with what is needed to change the filepath from a local filepath to that of the shared directory on the server.

              • 4. Re: store only as a reference file
                RobertRichards

                I am using Filemaker 9 on a MAC. I'm not that knowledgeable about fine tuning Filemaker. I appreciate the answers but don't know how to execute them.

                I set up container fields. When I inserted the pictures, I chose the option 'store only a reference file'. When I examine these container fields, I don't see the path that it's using to access the jpegs. If there is a simple way to do this then that's great, otherwise I will have to use a MAC indefinitely - which isn't so bad. Thanks again.

                • 5. Re: store only as a reference file
                  philmodjunk

                  One way to expose the filepath stored in the container is to define a calculation field and set it to return text as it's data type. Select your container field as the only term in this calculation. If the field were named "ContainerField", you just have ContainerField as the complete expression for your calculation field. You can place this field next to your container field and make it several lines of text high to see what information is stored in this container field.

                  The Filepath will start with either "ImageMac:" or "ImageWin" and is one of several entries you will find in this field.

                  Once you can see the file path to your image files, you can devise a calculation that you can use in Replace Field Contents to update them all to point to a different location.

                  Note also, that the path will be different for Mac clients on your network as opposed to Windows clients. It takes a fairly creative approach to get one set of container fields that correctly displays images for both platforms. (I use a calculation field where the calculation first checks for the client's platform and then returns the correct path for that platform.) This read only calcualtion field is set to return "container" as it's data type.

                  • 6. Re: store only as a reference file
                    raybaudi

                    "Treat the container field as though it is a text field"

                    Thanks, Phil. I didn't know that trick. Fine !

                    • 7. Re: store only as a reference file
                      RobertRichards

                      Thanks for the posts. I was able to create a calculation field that obtains the path of the files I want to access. I used the Get-as-text function.  I then tried creating a script to change the container field but was not successful - maybe I'm using the wrong script. As I said, I'm not that knowledgeable with Filemaker.

                      So for eg. my container field is named 'Container1'.

                      My calculation field (Get-as-text) which now has the information of the container field (path, name of file, etc.) is called 'Newfield'

                      Can anyone create for me, the script with the names of the fields so that I can do this? Much appreciated.

                      • 8. Re: store only as a reference file
                        philmodjunk

                        In my test, I moved a copy of a folder named "RaceCars) of images in My Pictures out to the desktop. I thus needed to update the container fields to use a path that points to this new folder on the desktop.

                        First I defined a field, cFileName, that extracts the file name out of the container field:

                        Let ( Path = GetValue ( containerField ; 2 ) ;
                                Middle ( Path ; Position ( Path ; "/" ; Length ( Path ) ; -1 ) + 1 ; 999 )
                               )

                        Then I ran a script with this step though I could have run it manually with no script:

                        Replace Field Contents [ no dialog ; YourTable::Container1 ; LeftValues ( YourTable::Container1 ; 1 ) & "image:RaceCars/" & YourTable::cFileName & ¶ & "Imagewin:" & Get ( DesktopPath ) & "RaceCars/" & YourTable::cFileName ]

                        Obviously, you'd need to craft a completely different expression for your system, but hopefully the syntax will give you some clues on how to go about it.

                        • 9. Re: store only as a reference file
                          raybaudi

                          Let ( Path = GetValue ( containerField ; 2 ) ;
                                Middle ( Path ; Position ( Path ; "/" ; Length ( Path ) ; -1 ) + 1 ; 999 )
                               )

                          or

                          Let(
                              v = Substitute ( containerField ; "/" ; ¶ ) ;
                              GetValue ( v ; ValueCount ( v ) )
                              )