2 Replies Latest reply on Aug 7, 2013 7:42 AM by philmodjunk

    Hi.. Using plugins..for select file ....i got the file path ..like " D:\demo\UI.fmp12 "...

    SamThomas

      Post

           Hi..

           Using plugins..for select file ....i got the file path ..like 

           "D:\demo\UI.fmp12"

           But i just want to path upto folder ..means.i just want "D:\demo"

           so how to remove filename from above path ..

           thanks

        • 1. Re: Hi.. Using plugins..for select file ....i got the file path ..like " D:\demo\UI.fmp12 "...
          shilpas@metasyssoftware.com

               Let (
               [
               strFilePath = "D:\demo\UI.fmp12"; // FieldName or scriptParameter
               x = PatternCount (strFilePath ; "\\");
               y = Position (strFilePath; "\\" ; 1; x);
               z = y-1
               ];
               Left ( strFilePath ; z )
               )
                

               returns "D:\demo"

               Let (
               [
               strFilePath = "D:\demo\NewFolder\UI.fmp12";
               x = PatternCount (strFilePath ; "\\");
               y = Position (strFilePath; "\\" ; 1; x);
               z = y-1
               ];
               Left ( strFilePath ; z )
               )

               returns "D:\demo\NewFolder"

          • 2. Re: Hi.. Using plugins..for select file ....i got the file path ..like " D:\demo\UI.fmp12 "...
            philmodjunk

                 Let ( [ path = put variable or field with your file path here ;
                            p =  Position ( path ; "\\" ; Length ( path ) ; - 1 ) ] ;

                           If ( p ; left ( path ; p - 1 ) )
                         )

                 And many uses of a filepath in FileMaker will requre replacing the \ with /. If that's what you need then enclose the If function in a substitute function call to make the character substitution: Substitute ( If ( p ; left ( path ; p - 1 ) ; "\\" ; "/" )

                 Note: the backslash, \ , has a special purpose inside quoted strings so you have to put in two of them in order for FileMaker to evaluate it as a single \ character.