1 Reply Latest reply on Sep 28, 2009 9:12 AM by philmodjunk

    String Extraction

    mtamitch

      Title

      String Extraction

      Post

      Hi

       

      I would like to create a script to extract a filename out of a string. This is a string generated by saving a file in a container as a file reference on a mac, but I want to open the file on a PC, and it won't because the path saved is a mac path.

       

      "file:7659 PO.pdf[Return][Return]filemac:/team/Document Archive/7659 PO.pdf"

       

      I would like to extract, in this case, "7959 PO.pdf" from the string. The filename can be any reasonable length, and number of words. Is this possible?

       

      Thanks for your help in advance. 

        • 1. Re: String Extraction
          philmodjunk
            

          Let ( start = Position(table::FileRefField; ":";1;1)+1 ;
                 Middle (table::FileRefField;start;Length(table::FileRefField) - start - Position(table::FileRefField; "¶";1;1))
                )

           

          Use this as either a calculation field definition or the expression in the second parameter of a set field or set variable script step.