3 Replies Latest reply on May 1, 2017 1:08 PM by philmodjunk

    Container field file name

    vsabula

      I have a database that has several photo container fields with external storage. What I would like to do is have the photos automatically renamed with a word (Receiving) + field name (Photo 1) + date (Date). Is this possible? Regardless of the original file name (let's say "Untitled-1"), the image file name in the external storage for the database would be (for example) "Receiving Photo 1 04272017" after being imported into the container field. It would make the organization of the photos much better in the database.

        • 1. Re: Container field file name
          philmodjunk

          A script can export the file to your temporary folder and specify the file name to use for the exported copy--which can be a calculated filename that you specify, except that the date part will have to be modified to leave out / characters that otherwise produce an illegal file name.

           

          You can then delete the original file and insert the renamed copy from the temporary folder to take its place.

           

          All via script.

          • 2. Re: Container field file name
            vsabula

            Thank you philmodjunk! I would like to avoid having to manually move files more than necessary. Here is what I am picturing. I have a database called "Test" with a photo/container field called "Photo1" and the date of the record is (without bad characters) "05012017". The photo/container field is stored to external storage. I have a photo on my desktop called "Lollipop". When I use "Insert Picture" to insert the "Lollipop" photo in photo/container field "Photo1", I would like for the file that gets saved to external storage to be automatically named (in the external storage folder for the database and container) "05012017TestPhoto1". Is this possible using the script you mentioned?

            • 3. Re: Container field file name
              philmodjunk

              Yes it is.

               

              GetcontainerAttribute can extract the file name of a file in a container.

               

              Let ( d = get ( CurrentDate ) ;

              Right ( "0" & month ( d ) ; 2 ) &

              Right ( "0" & day ( d ) ; 2 ) &

              year (d)

              )

              will produce the date