3 Replies Latest reply on Dec 14, 2014 2:02 PM by haseebiqbal

    Update file references of container field

    haseebiqbal

      Hi

      My question is about moving files that are linked in a container field.

      Our company has recently restaructued shared network drives.

      I have moved all of the linked.pdf or linkd.doc files to new folder structure, the link in the container field still points to the old location.

       

      I have created a Calculted Text field to retrieve the patch using

      GetAsText ( Document container)

      formula

      i.e. filewin:/G:/XXXX Syd/ARCHIVE/XXXX SHARED/XXXX ONLINE/XXXXXXscreen/XXX Clearances/Correspondence with rightsholders/XXXXXXX16102012.pdf

       

      Is there a way to update the container link(Reference) to the new folder location?

      Should be replaced with newer path, file name(pdf/doc) files remain same.

       

      Thanks

       

      FileMaker Server 10 (Windows)

      FileMaker Client 11 (Windows 7)

        • 1. Re: Update file references of container field
          mikebeargie

          Unfortunately since you're not on 12+, you can't use the base directory container management window to do this the easy way.

           

          You will need to calculate the new file path, while looping through and updating each record's path.

           

          This might help:

          http://help.filemaker.com/app/answers/detail/a_id/549/~/recreating-file-references-for-container-fields

           

          your script would look something like:

           

          Loop

             Set Variable [ $old ; GetAsText(table::container) ]

             Set Variable [ $new ; Substitute($old ; "filewin:/G:/" ; "filewin:/Z:/" ) ]

             Insert File [ Table::container ; $new ; "as reference" ]

             Go To Record [ next ; exit after last ]

          End Loop

           

          There might be an easier way but I haven't dealt with a transfer in <12 for a few years now.

           

          This does require the container field contents to be in both places while the transfer takes place.

           

          Also, as usual, make sure you backup your original FM7 file just in case.

          • 2. Re: Update file references of container field
            taylorsharpe

            As Mike noted, there are easier ways to do things in the current version of FileMaker.  Also, FileMaker has deprecated supported for version 10 and announced the depreciation of support for 11.  If your data has value, and if nothing else but for security reasons, you should be looking to upgrade. 

             

            Some of the new container support features includes previews that only pull across images necessary for the size of container, thereby making container fields of pictures load MUCH faster.  And the whole Remote Storage in FM 12/13 integrates so well and includes additional security features like encryption.  Between performance and security, it has been nicely improved upon by FileMaker. 

             

            Best of luck with the scripting.  Make sure the GetAsText returns what you need in the reference (you might only need one line of it and use the GetValue function to do that).  Let us know if you have problems implementing the loop and well help out.

            • 3. Re: Update file references of container field
              haseebiqbal

              I wrote following script as per you Mike. Thanks a lot mate.

               

              SCRIPT Update FilePath

              Go to Record/Request/Page [ First ]

              Loop

              Set Variable [ $old; Value:GetAsText ( Table::Document container ) ]

              Set Variable [ $new; Value:Substitute ( $old ; "/old folder/" ;"/new folder/" ) ]

              Insert File [ Table::Document container; “$new” ] [ Reference ]

              Go to Record/Request/Page [ Next; Exit after last ]

              End Loop

               

              Note: Make sure while running the script the new path is accessible.