2 Replies Latest reply on May 5, 2014 6:50 AM by fmpro_novice

    Insert file name into a field

    fmpro_novice

      Title

      Insert file name into a field

      Post

           Does anyone know a way for a user to browse for a file name and insert just the file name into a field?

           I do not want to include the file - just the name of the file.

        • 1. Re: Insert file name into a field
          philmodjunk

               I know you want just the file path, but bear with me here til you get to the end:

               Use a container field, with the insert file script step to open a dialog for finding and inserting the user selected file.

               You can specify "store a reference" for the insert file script step since you don't want an actual copy of the file if you want but the following calculation can extract the file name for the inserted file no matter what insertion method and storage option is specified:

               //This should work for all insertion and storage methods except Insert Object (Filemaker 11, WIndows only):
               Let ( [ T = If ( LeftWords ( YourTable::ContainerFIeld ; 1 ) = "remote" ; GetValue( YourTable::ContainerFIeld ; 1 ) ; GetValue ( YourTable::ContainerFIeld ; ValueCount ( YourTable::ContainerFIeld ) ) ) ;
                         L = Length ( T )];
                         If ( LeftWords ( T ; 1 ) = "remote" ;  Right ( T ; L - 7 ) ; Right ( T ; L - Position ( T ; "/" ; L ; -1 ) ) )
                   )

               This can also be found in the database file that can be downloaded from: Exploring the use of a $Path Variable in Scripts

                

          • 2. Re: Insert file name into a field
            fmpro_novice

                 Wow, that's really cool.

                 Thanks, Phil