9 Replies Latest reply on Dec 11, 2014 7:53 AM by philmodjunk

    File path for referenced files



      File path for referenced files



      A question regarding a Filemaker Advanced Pro 12 database.  

      My database is heavily based around adding files, mostly images with some PDF's into a portal record.  All the files I add are usually kept within a folder on the desk top, or somewhere else on the drive.  There is a container field in my portal that will show a picture of the referenced image, or the referenced PDF.  

      My issue is, that if I update the computer that my database is installed on, the file path for all the referenced files will of course change, even if I move the folder cottoning the files is move the the same location (lets say the Desktop). The data will still be there, but the container image can not be found because of the different file path, therefore it is blank.  

      I use referenced images instead of imbedding them because of the number and the size of the images...

      Is there a way to actually enter the file path for the folder that contains the referenced files into a field so this issue can be overcome.  Mitch 



        • 1. Re: File path for referenced files

          Easiest way is to map the folder as a drive letter.  When you move the folder, just remap it to the same drive letter.  You should be able to recalculate the path from your desktop to the new mapped drive, to update the images you have already stored.

          • 2. Re: File path for referenced files

            If you are using FileMaker 12 or newer, you might consider using external storage with the storage location specified on a file server instead of files and folders scattered all over your computer.

            You can also use Replace Field Contents to modify the file path of container fields in a batch operation by modifying the file paths in the container fields by treating them like they are text fields instead of container. This requires knowing the precise format of file paths in container fields and being able to construct a calculation that takes the existing file path and modifies it to update the path to point to the new location.

            • 3. Re: File path for referenced files


              I am hopeful in writing a script that will get the full path of each referenced image, then perhaps having a script that will allow the path to be edited, then updated if needed.  It may not be pretty, but should work.

              The path is quite long.  Eg: /Macintosh HDsize:396,396 image:Images/Test 1.jpg imagemac:/Macintosh HD/Users/user 1/Desktop/Images/Test 1.jpg

              It is only of course the path "/Macintosh HD/Users/user 1/Desktop/Images/" that needs editing, as the image file name will remain the same.  Is there a way of splitting the path into several fields, isolating the "/Macintosh HD/Users/user 1/Desktop/Images/" in one field allowing it to be edited, then the full path re-assemble in another script to be updated in the container field?. 

              Or am I going about this the long way?


              • 4. Re: File path for referenced files

                You could do it that way, but why? A single replace field contents can probably do the "file path surgery" needed to update your container fields' file paths to point to the updated locations as long as the changes made by your "move" are consistent.

                You might find this thread on $Path variables, container fields and the script steps that can use them helpful: Exploring the use of a $Path Variable in Scripts

                • 5. Re: File path for referenced files


                  You're right,  I am looking at it as if somehow has to be difficult.  



                  • 6. Re: File path for referenced files

                    Thanks for the link to the $Path variables, its helped a lot.  One question:  If I replace the container field which has a 'Referenced' image in it, with the new text path of the the same image, Filemaker no longer sees the image in the conner as being 'Referenced', when it still a referenced image ....  Is there anyway to overcome this?




                    • 7. Re: File path for referenced files

                      I don't really understand your description. If you recreate the exact same format as before but with a different file path, the container should still function as before.

                      • 8. Re: File path for referenced files

                        I think my issue was that I was updating the path with the Literal Path, instead of the exact extract of the container field that contains the image size and name prior to the lateral path.  I tried all the variants, the only one that remains referenced is the extract.

                        Is there any way to change or edit a folder name within this path; based on field values? Eg; If user wants to add folders with the main folder (already in the path) and each of these folders named by record number.  Therefore needing to add the additional folder name fto the path?  

                        A loop will alter the container path per record, which I am doing now, but the path details have to be extracted and the new folder added to the path?



                        • 9. Re: File path for referenced files

                          Within the filepath in the container field, it doesn't matter if it's a drive letter, volumne name, folder name or file name. It's all text and the same text functions can be used to take the existing file path and compute a new path pointing to the new location. But it's all very, very detail specific. Get one little detail wrong and it fails to work. The "tags" (file:, filewin:, imagewin:...) at the beginning, for example are case sensitive. Capitalize them wrong and the file path doesn't work.

                          That's where the exploration file comes in handy. You can insert a file from the new location into the container field and then examine the full contents of the text extracted from the container field and figure out what changes are needed to convert the old path into the new.

                          I assume that these kind of "headaches" are one of the reasons for the new "external storage" option that you can set up to store all your files in a folder located on a file server.